How do I reformat input in FormMail?

This article details how to reformat input fields in FormMail.

This example shows the use of the <format> tag to reformat some input fields using FormMail. Try a demo.

Form

<html>
<head><title>Just testing</title></head>
<body>
<form method="post" action="http://www.uic.edu/htbin/cgiwrap/bin/formmail/FormMail/depts/accc/forms/formmail/example-7.txt">

<h1>Example of FormMail 3.0</h1>
This example shows the use of <em>Format</em> to reformat some
input fields, and possible interaction with <em>validation</em>
of these fields.  Note the <em>debug</em> flag is turned on,
so you can see the results of the reformatting.
Try different values in the input, and see how (and if) it gets reformatted.
<p>

Email: <input type="text" name="email"><br>
Phone: <input type="text" name="phone"><br>
Digits: <input type="text" name="digits"><br>
Text: 
<textarea rows=3 cols=20 name="newline">
</textarea>

<hr>
<input type="submit" value="Submit the form">
</form>
</body>
</html>

Configuration file

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

 <!-- List all the fields needing potential reformatting -->
<format name="email" vtype="email">
<format name="phone" vtype="phone">
<format name="digits" vtype="digits">
<format name="newline" vtype="newline">

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

<validate name="email" public="The email field"  vtype="email" > 
<validate name="phone" public="The phone field"  vtype="phone10" > 
<validate name="digits" public="The digits field"  vtype="digits" > 

  
 <!-- 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" >
<![CDATA[
<html><head><title>Junk</title></head><body>
<h1> Thank You for Submitting your Info</h1>
The email field became: $email<br>
The phone field became: $phone<br>
The digits field became: $digits<br>
The textarea became: <code>$newline</code><br>
</body></html>
]]>
</response>

</form>



Keywords:mail, code, script, configure, form   Doc ID:91748
Owner:Radhika R.Group:University of Illinois at Chicago ACCC
Created:2019-05-15 08:58 CDTUpdated:2019-06-11 13:28 CDT
Sites:University of Illinois at Chicago ACCC
Feedback:  0   0