Refreshing forms on the Web

Refreshing forms on the Web

The Notes Client paradigm is not easily emulated on the web. But with a few behind-the-scenes tricks, you can implement the most powerful hide-when and computed field functionality - without saving the document until you're ready.

Some Notes Client functionality is automatically available on the web. For example, when you have a radio button with two possible values, and it is set to refresh fields on keyword change. Domino achieves this in the browser using JavaScript with a special function called _doClick(). Basically, when you change the value of the radio button, the _doClick function tells Domino which field has been clicked. This allows Domino to re-compute the form based on the new field value. In addition, it returns the form to the browser with an anchor-link so that the browser scrolls down to the field that has just been clicked.

Now to put this knowledge to work. Lets say we have a collection of computed-for-display fields similar to a mini-spreadsheet on our form. We also have one editable field that is used in the formulas of the computed fields. Lastly, we have a refresh button so that changes in the editable field take effect in the computed fields.

The JavaScript code behind the button is:
_doClick ('refresh', this, null, null)

This code alone will refresh the form without submitting it.

Now, to make the browser scroll down to where we previously were, we need to create a pass-thru HTML code at the point

    Requires Free Membership to View

    Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.

    By submitting your registration information to SearchDomino.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDomino.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

we want to scroll down to:

<A NAME="anchor1"></A>

This is called an Anchor Link. For Domino to take advantage of it, the code must now look like this:

_doClick ('refresh', this, null, 'anchor1')

That's it! Don't forget to enable "Use JavaScript when generating pages" in the database properties.

This was first published in April 2001

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.