Notes Ninjas Notes Ninjas
Lotus Notes hints, tips, error messages
Input Validation On Web

Hint Short Cut: Add this to your code & documentation to help you find this page.
http://www.notesninjas.com/#InputValidation or http://www.notesninjas.com/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.

 

 

 Jump to:     Notes Tips
    Lotus Notes Index 
  Register for Tips
Previous Lotus Notes Tip 
    Next Lotus Notes Tip, Next Lotus Notes Tip
Your company logo here?
Adam Foster
Free Cash Making Web Site
Free Revenue Earning Blog Site
 Free Revenue Earning Newsletter Site   
Free Search Pages Free Web stats
Free Contact Us page
Cheap .com domain names
 Need a website or 
   Lotus Notes
  problem solved?
Adam Foster
Lotus Notes 5 All-in-one Certification Exam Guide by Libby Schwarz, Ben Malekzadeh
Sort out your CLP with this book.
See at: Amazon.co.uk | Amazon.com |