Lotus Notes FAQ Visit Our Sponsor!

How do you make onSubmit work with keyword refresh?

If you turn on "Use Javascript when generating pages" option of the database properties, you'll find that the onSubmit code gets invoked every time the user changes a keyword field that is set to refresh on change.

Put all your validation code into a function in the JSHeader event like this:

function validateForm()
  var f = document.forms[0]
  if (f.Description.value == "") {
    alert ("Please enter a description.");
    return false;
  return true;

Then, change the onClick action of the submit button on your web form to call this function before submitting the form:

  @URLOpen("javascript:if (validateForm())  document.forms[0].submit()")

Applies to Notes Versions: 5
Last Modified: October 2, 2001