Manage Learn to apply best practices and optimize your operations.

$$Return Alternative

In my Domino web applications, I like to use pop-up boxes to edit different groups of fields on a document. For example, I might have a tabbed form with 5 related fields on each tab. To edit each tab's fields, I use pop-up forms. This lets me enforce some security, show/hide different contextual menu choices, present only the editable form to those users who can access it, etc.

In doing this, I don't much care for the $$Return field since different things can happen when the user submits the form. (Besides, complex formulas can get pretty messy and difficult to read once the development cycle is complete.) For instance, if I'm using Domino to capture data and then sending that data off to a relational database, the update can succeed or fail. If it fails, I need a smooth way to inform the user. If it succeeds, I need to refresh the 'read only' form / frames to reflect the results.

Enter this tiered approach to keeping everything in sync. It is simple to implement and lets you pass Javascript back to your pop-up form based on an agent's run-time environment.

It's based on a couple of different elements:
1. Put a hidden field on your pop-up form called 'ReloadString'
2. Before the pop-up form is saved, store javascript in ReloadString that you want to happen if the save is successful e.g. "window.opener.location='/db.nsf/view/docid?Opendocument'"
3. For the pop-up form's WebQuerySave event, enter an agent to run against the saved data.
4. In the agent, do whatever you need to do to the saved data i.e. save it via ODBC to a relational database, update some other documents based on the saved data, etc.>
5. At the end of your agent, if all is well, send the javascript in the ReloadString field back to the pop-up form via print statements e.g.

Print "<html><body><script>(contents of ReloadString);window.close;</script></body></html>"

If all is not well, send back the error or other information via a Print statement e.g.

Print "<html><Head>Error</Head><Body>Could not update the data on datasource MyDatasource. Record not saved.</Body></Html>"

This will let your pop-up window manipulate other browser windows and then close itself. This is really handy if you have a form with embedded Layers or IFRAMES that invoke pop-up forms. The user can change data from one frame and, if the update succeeds, see those changes reflected in the other frames/layers.

This was last published in February 2001

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...