| **Navigation:**  [[templates.htm|Templates]] > [[tlrcontents.htm|Template Language Reference]] > Complete Alpha Listing >====== #VALIDATE (validate prompt input) {{c6h0068.jpg|C6H0068.jpg}} ====== | [[ utility utility execution section .htm|{{btn_prev_n.gif|Previous page}}]][[tlrcontents.htm|{{btn_home_n.gif|Return to chapter overview}}]][[ where define code embed point availability .htm|{{btn_next_n.gif|Next page}}]] | | || **#VALIDATE(** //expression,message// **)** {{blk2blue.jpg|blk2blue.jpg}} | **#VALIDATE** | Validates the data entered into the immediately preceding #PROMPT field. | | //expression// | The expression to use to validate the entered data. | | //message// | A string constant containing the error message to display if the data is invalid. | The **#VALIDATE** statement validates the data entered into the #PROMPT field immediately preceding the #VALIDATE. The //expression// is evaluated when the OK button is pressed on the Procedure Properties window. If the //expression// is false, the //message// is displayed to the programmer in a message box, and control is given to the #PROMPT field that immediately precedes the #VALIDATE. There may be multiple #VALIDATE statements following a #PROMPT to validate the entry. A #PREPARE structure may follow a #PROMPT prior to the #VALIDATE, but no other template statements are valid between #PROMPT and #VALIDATE, including template comments. **Example:** **#PROMPT('Input Value, Even numbers from 100-200',@N3),%Value** **#VALIDATE****((%Value > 100) AND (%Value <; 200),'Value must be between 100 and 200')** **#VALIDATE****((%Value % 2 = 0),'Value must be an even number')** **#PROMPT('Screen Field',CONTROL),%SomeField** **#PREPARE** ** #FIX(%Control,%SomeField)** **#ENDPREPARE** **#VALIDATE****(%ControlType = 'LIST','Must select a list box')** **#PROMPT('Select Change Date/Time Group:',FIELD(%Primary)), %ChangeDateGroup,REQ** **#PREPARE** **#FIX(%File,%Primary)** **#FIX(%Field,%ChangeDateGroup)** **#ENDPREPARE** **#VALIDATE****(%FieldType = 'GROUP','Change Date Group must be of type GROUP!')** **See Also:     [[ prompt entry types.htm|#PROMPT]]**