Topics Map > Communication & Collaboration > Email & Calendaring
Topics Map > Communication & Collaboration > Website Services

How do I configure conditional validation with FormMail?

This article details how to configure conditional validation with FormMail.

This example demonstrates conditional validation with FormMail. Try a demo.


<head><title>Just testing</title></head>
<form method="post" action="">
<h1>Example of FormMail 3.0</h1>
This example shows the use of <em>conditional</em> input validation.<br>
Input some text: <input type="text" name="nonnull"><br>
<input type=checkbox name=checktext value=yes>Check the text for nonnull value.
<input type="submit" value="Submit the form">

Configuration file

<!DOCTYPE form SYSTEM 'FormMail-3.0.dtd'>
<form name="example6" >

 <!-- List all the fields needing server-side validation -->

<validate name="nonnull" public="The nonnull field"  vtype="nonnull" if="$checktext">

 <!-- This prevents any mail being sent for this example -->

<mail name="mail2" nomail>

 <!-- Here's the html response when all input is valid 
      Note that the full html page is generated, including
      the <html>...</html> tags 

<response name="r0" >
<h1> Thank You for Submitting your Info</h1>
The text field was: $nonnull<br>

 <!-- This response only kicks in if $stuff2  (ie the
    value for the field that wasn't checked) is not blank -->

<response name="r1" if="$checktext" >
The above text field was checked for nonnull value.<br>

<response name="r2" if="NOT $checktext" >
The above text field was <em>not</em> checked for nonnull value.<br>

 <!-- And finally, the end!  -->

<response name="r3" >
  The date is $fm_date.<br>


Keywords:form, file, mail, valid   Doc ID:91739
Owner:Radhika R.Group:University of Illinois Chicago Technology Solutions
Created:2019-05-15 07:31 CSTUpdated:2019-06-13 10:53 CST
Sites:University of Illinois Chicago Technology Solutions
Feedback:  0   0