MailSerf Example: Specifying Required Fields


This example shows how specify which fields must be filled out before a form will be accepted for submission.

The following HTML form sends a message to the address specified in the To field, with the subject MailSerf required-fields example. The To, Input 1, and Input 3 fields are required, but Comments and Input 2 are not....

<form action="/cgi-bin/mailserf" method="POST">
    <input type="text" name="hdr:to"> To *<p>
    <input type="hidden" name="hdr:subject" 
     value="MailSerf required-fields example">

    <input type="hidden" name="ctl:required" value="input1,input3">

    <input type="text" name="input1"> Input 1 *<br>
    <input type="text" name="input2"> Input 2<br>
    <input type="text" name="input3"> Input 3 *<p>
 
    <input type="text" name="comments"> Comments<p>
 
    <input type="submit">
    <input type="reset"><p>

    <i>* indicates that the field must be filled out.</i>
</form>


To *

Input 1 *
Input 2
Input 3 *

Comments

* indicates that the field must be filled out.


Return to the MailSerf Examples