I never bothered learning JS for validation - have always used this technique.
Now that you point out the JavaScript in the address bar - yikes !
Anyway, I place all of the code in the Submit button. No agents, no WQS.
I use one or more CFD errormessage fields and the formula includes @Return. If
an error condition is found, then @Return, else do nothing (fall through to the
next statements which save and redirect). @Return will reopen the document
with the error message displayed but will not save the doc. SaveOptions is not
necessary.
Long time reader - first time poster.
I never bothered learning JS for validation - have always used this technique. Now that you point out the JavaScript in the address bar - yikes !
Anyway, I place all of the code in the Submit button. No agents, no WQS.
I use one or more CFD errormessage fields and the formula includes @Return. If an error condition is found, then @Return, else do nothing (fall through to the next statements which save and redirect). @Return will reopen the document with the error message displayed but will not save the doc. SaveOptions is not necessary.
Below is sample formula:
t1 := @If(Name = ""; "Name"; ""); t2 := @If(City = ""; "City"; ""); t3 := @If(State = ""; "State"; ""); t4 := @If(Email = ""; "Email"; ""); tall := @Trim(t1 : t2 : t3 : t4);
@If(tall = ""; ""; @Return(@SetField("ErrorMessage"; "Please supply a value for: " + @Implode(tall; ", ") + ".")));
@Command([FileSave]); @URLOpen("/" + @WebDbName + "/Profiles?OpenView" )