< Back

Document Subject: Input Validation On Web
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#InputValidation or http://A555F9/nn.nsf/ByAlias/InputValidation

This is a simple bit of code that I put in mandatory fields for Input Validation purposes that will work on Notes and Web.




 

In this example Name is the name of the field and needs to be changed for each Input Validation formula. (There is a new way of doing this in Rnext see the section)

thisField:="Name";
@If(
Name="" & @clienttype="Web";
@Failure("<b>Please Complete the Form</b><br>"+
     " " + thisField +  " should be answered."  +
     "<br><br>"+"<form>"+"<input type=\'button\' value=\'Back\' onclick=\'history.back();\'>");
Name="";
@Failure( thisField+ " should be answered." );
@Success)

 

If you have many fields, this method will allow you to change to style of the message quickly: add this to a computed field called "InputValErrStart"

 "<b>Please Complete the Form</b><br>"

Another computed when composed field: "InputValErrEnd"

"<br><br>"+"<form>"+"<input type=\'button\' value=\'Back\' onclick=\'history.back();\'>"

and then use this code:

thisField:="Name"
@If( Name="" & @clienttype="Web"
 @Failure( InputValErrStart+" " + thisField +  " should be answered."  + InputValErrEnd);
 Name=""
 @Failure( thisField+ " should be answered." );
@Success)

 

The Save button formula should be:

r:=@Command([FileSave]);
@If(r=0;
   @Return("");
   @URLOpen("http://www.adfos.com";))

Change @URLOpen to whatever you wish to direct the user to after they have correctly entered the data.