This page shows you the code used to generate the form on the Validation Errors Array demo page.


<cfscript>
 // init an array to hold the errors
 errs = arrayNew(1);
 
 // create a struct for the Email property/field error and append it to the array
 st = {property="email",message="The Email Address is invalid."};
 arrayAppend(errs, st);
 
 // create a struct for the Password property/field error and append it to the array
 st = {property="password",message="The passwords do not match."};
 arrayAppend(errs, st);
</cfscript>
<div id="wrap">
 <div class="cfUniForm-form-container">
  <uform:form action="#cgi.script_name#" 
     id="myDemoForm" 
     cancelAction="index.cfm" 
     errors="#errs#" 
     errorMessagePlacement="both" 
     loadjQuery="true" 
     loadValidation="true">
   
   <uform:fieldset legend="Required Fields">
    <uform:field label="Email Address" 
       name="email" 
       isRequired="true" 
       type="text" 
       hint="Note: Your email is your username.  Use a valid email address." />
       
    <uform:field label="Re-enter Email Address" 
       name="email2" 
       isRequired="true" 
       type="text" 
       hint="Note: Please re-type your email." />
    
    <uform:field label="Choose Password" 
       name="password" 
       isRequired="true" 
       type="password" /><!--- for security purposes, we don't populate the password --->
    
    <uform:field label="Re-enter Password" 
       name="password2" 
       isRequired="true" 
       type="password" /><!--- for security purposes, we don't populate the password --->  
   </uform:fieldset>
  </uform:form>
 </div>
</div>