DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Frame definition files

Validating a form field

Let us add some more functionality to the form. Assume that in this form it is valid to enter addresses of only three states: New York, New Jersey, and Connecticut. To do this, three more field descriptors are added to the State field in the frame definition file:

   .
   .
   .
   name=State
   nrow=2
   ncol=21
   columns=2
   rmenu={ CT NJ NY }
   menuonly=true
   invalidmsg=Valid state codes are: CT, NJ, NY
   .
   .
   .

Form.3choices: an example of field validation using the menuonly descriptor

This form definition file will create the same form as above. However, the rmenu descriptor is used to create a choices menu, and the menuonly descriptor defines only the choices in the choices menu to be valid field values. If the user enters an invalid state code in the State field and presses <<Return>> or <SAVE>, the message defined by the invalidmsg descriptor appears on the message line and the done descriptor will not be evaluated.

When the user presses <CHOICES> the first valid state code, CT, will be displayed in the State field (see the description of toggle in ``Application level definition files'' for a discussion of how to change this default behavior). Each press of <CHOICES> displays the next valid state code (wrapping to the first choice after the last one is displayed).

Now we will add some more state codes to the list of states in our rmenu descriptor and we will change the invalidmsg descriptor to reflect the changes:

   .
   .
   .
   name=State
   nrow=2
   ncol=21
   columns=2
   rmenu={ CT IL NJ NY PA FL }
   menuonly=true
   invalidmsg=(Press CHOICES to see valid state codes)
   .
   .
   .

Form.6choices: an example of a choices menu

This frame definition file creates the same form as before. But now if the user enters a wrong state code, the following message will be displayed at the bottom of the screen:

   (Press CHOICES to see valid state codes)
To find the valid state codes, the user can again press <CHOICES>. This time the valid choices are displayed in a pop-up choices menu. This behavior occurs by default when there are more than three choices in the rmenu list:

Form.6choices: screen output

When the user selects a code from the choices menu, the code is placed in the State field and the choices menu is closed, as shown in ``Form.6choices: screen output after user selects an item from the choices menu'':

Form.6choices: screen output after user selects an item from the choices menu


Next topic: Example of validating a field value with the valid descriptor
Previous topic: Addr.file: contents after user saves the form

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004