Manage Learn to apply best practices and optimize your operations.

Input validation that uses HTML field attributes in R5

This input validation takes advantage of the HTML tab (the last one) in the R5 field properties in two ways.

This input validation takes advantage of the HTML tab (the last one) in the R5 field properties in two ways.

First, it uses the other section to assign an attribute to the field(s) in question.

Second, it uses the title section to display a meaningful name for the field(s) in question.

Scenario: I have five text fields on a web form. Three of them are mandatory and require validation for non-blank entries.

For the mandatory fields MF1, Mf2 & MF3:
1. Assign an attribute such as FT=M (Field Type=Mandatory) in the other section of the HTML field tab.
2. Enter the descriptive name of each field in the title section of the same tab. This will be used in the message displayed to the user. Example: for MF1 the descriptive tile is: Customer Creation Date

 Code (in the JS Header of the form):
function validate()
var f=document.forms[0]
//Loop through the elements of the form looking for fields with name=text AND Tagged with the attribute FT=M
for (i=0;i<f.length;i++)

//If element if a text field AND is mandatory (i.e. FT=M) AND has been left blank, capture it.
if(f.elements[i].type=="text" && f.elements[i].FT=="M" && f.elements[i].value=="")
alert("You must enter " + f.elements[i].title)
//Return user to offending field
//terminate function
return false
//End of Code

The above code works equally well for a ComboBox. The field type to look for is "select-one" instead of "text."

Dig Deeper on Domino Resources - Part 8

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...