Manage Learn to apply best practices and optimize your operations.

Utilize The Javascript Onsubmit Event To The Max!!!

I use the onSubmit quite a bit. Two easy things to use it for:

1. **Use the onSubmit to stop a FORM from saving and jump to another URL**
I've come across situations where I'll develop a form to trap information (such
as user name) and I then want to open another form but not submit the current
form to the database to be saved.

2. **I use the onSubmit to check for field validations using JavaScript rather
then send the form to the server and having the server do the traditional Notes
Input Validation (sending to the server takes time and then the user has to hit
back on his browser - yuk...).
1. setpasURL is a field on the form I used to compute a link to go open the
users person document in the NAB...
// the field formula is :
//Temp := @Name([CN];@UserName);
//last := @RightBack(Temp;" ");
//first := @Left (Temp;" ");
//"" + last + "+,+" +
//first+"?EditDocument&Query=*send CGI Query_String info*"

//onSubmit script
//the "return false" part stops the form from being saved...
doc = window.document.forms[0];
window.location=golink1;return false


2. This is a sample of the validation JS I used to check 2 name fields for
If valid values found convert the name to uppercase and then update a field
From to the value that was typed into the name fields...

nme=fn + " "+ln;

//Check for valid values
// if invalid values stop form processing and return user to field in error
if(fn==""){alert("First Name is Manditory");doc.FName.focus();return false};
if(ln==""){alert("Last Name is Manditory");doc.LName.focus();return false};

//Otherwise do stuff before processing
doc.From.value = nme.toUpperCase()

Dig Deeper on Domino Resources - Part 7



  • 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 ...