I have a form on the web that whenever someone hits enter it will use the $$return to go to the next page even if the form is not complete.
Being new to domino development I am sure there is a better way of doing this. However I am curious to see if there is a way that I can disable the $$return field if another field is blank. Any comments/suggestions are appreciated.
Subject: Disable $$Return using If statement
I’m guessing your hard return is just submitting the document, thus the $$Return field kicks in.
I’d recommend using JS to capture field values before submit, thus you can stop it from submitting if certain values are not completed.
There is an onKeyPress option on a form objects that put in JavaScript there to do the check. Something like:
var ieKey = event.keyCode;
if ((ieKey == “0”) || (ieKey == “13”)) {
//do check here. Return false if it fails.
}
Good Luck.
Tim Williams
Subject: RE: Disable $$Return using If statement
would the check be in JS or lotus formula??
I want to use this lotus script or something similar in JS.
@IF ( Fnm = “”; false; @success)
Would this work?
Subject: RE: Disable $$Return using If statement
Inside the form under the Objects tab, look for the “onKeyPress” option under the “Form” values. The check would have to be JavaScript. Pretty much what is below gets put into the “onKeyPress” option:
var ieKey = event.keyCode;
if ((ieKey == “0”) || (ieKey == “13”)) {
var doc = document.forms[0]
if (doc.FieldName.value == “”) { //“FieldName” is replaced with the name of the field.
alert( "sorry, but the field is blank." )
doc.FieldName.focus() //if you want to take cursor to the field.
return false
}
}
Check this URL out for more event keycodes in JavaScript.
http://webonweboff.com/tips/js/event_key_codes.aspx
Good Luck!
Tim Williams