How to Code the "Submit" Button when Using JavaScript Form Validation
One more "reference piece" for me... From the KnowledgeBase...
How to Code the "Submit" Button when Using JavaScript Form Validation
Doc Number: 1087237
Problem
Using Domino Designer 5.x, you want to
use JavaScript to validate a form's input values before allowing a document
to be submitted and you would like to design this form so that it works
the same way in a Notes client as it does from a web browser. But
when you select a Button that saves and closes the window from a Notes
client you find that the document is closed regardless of whether input
validation failed or not.
Content
Using Domino Designer 5.x, the Submit button
on the form can be coded as follows:
@If(@Command([FileSave]); @Command([FileCloseWindow]);
"" )
The JS Header property of the form has
the following code:
function validate() {
if
(document.forms[0].Test.value == "") {
alert("Must enter value for Test");
return false;
}
}
The onSubmit event of the form should be
coded as follows:
return validate()
When the form's Submit button is selected,
the browser displays a JavaScript Alert and the document will NOT be submitted
to the server.
To provide this functionality on a Domino
4.6.x server, see document number 172406, "Global Input Validation
with JavaScript in a Web Browser."



Comments
Posted by At 14:40:10 On 14/11/2005 | - Website - |
I have, however, successfully used a JavaScript regular expression in a field validation that I got from some blog or web site, I just cannot rememeber where at the moment. So maybe I should move ahead with the times...
Posted by Christopher Byrne At 10:21:58 On 20/07/2004 | - Website - |
Posted by ityi At 11:14:08 On 07/08/2006 | - Website - |
Posted by tershia At 01:07:42 On 09/06/2009 | - Website - |
Posted by Balubestdeals At 08:08:41 On 23/06/2009 | - Website - |
Posted by lbr135 At 03:05:23 On 04/08/2009 | - Website - |
Posted by anneta jfiroe At 07:37:52 On 04/11/2009 | - Website - |
Posted by cvb At 17:16:25 On 11/04/2010 | - Website - |