yoshismokey
Programmer
I have a CFFORM with CFINPUT statements containing validate for zip, phone, etc. When I run the code, the order of validation is random and jumps all over the place. Is there any way to fix this?
Here is the code:
<cfform name="addagency" action="AddAgency1.cfm" method="post">
<tr>
<cfif IsDefined('form.agency_name')>
<td class="FormTitleFieldName"> <div align="left">Agency Name:</div></td>
<td><input type="text" name="Agency_Name" value=<cfoutput>"#Agency_Name#"</cfoutput> maxlength="50" size="50"></td>
<cfelseif NOT IsDefined('form.agency_name')>
<td class="FormTitleFieldName"> <div align="left">Agency Name:</div></td>
<td><cfinput type="text" name="Agency_Name" required="yes" message="You must enter an agency name" maxlength="50" size="50"></td>
</cfif>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">
<p class="FormTitleFieldName">Address 1:</p>
</div></td>
<td><cfinput type="text" name="Address1" required="yes" message="You must enter an address" maxlength="50" size="50"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">Address 2:</div></td>
<td><cfinput type="text" name="Address2" maxlength="50" size="50"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">City:</div></td>
<td><cfinput type="text" name="City" required="Yes" message="You must enter a city" maxlength="20" size="20"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">State:</div></td>
<td><cfinput type="text" name="State" required="yes" message="You must enter a state"maxlength="20" size="20"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">Zip Code:</div></td>
<td><cfinput type="text" name="Zip" maxlength="10" size="20" required="Yes" validate="zipcode" message="You must enter a valid Zip Code"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">Contact:</div></td>
<td><cfinput type="text" required="yes" message="You must enter a Contact name" name="Contact" maxlength="20" size="20"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">Phone:</div></td>
<td><cfinput type="text" name="Phone" required="yes" validate="telephone" message="You must enter a valid phone number" maxlength="12" size="12"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">Email:</div></td>
<td><cfinput type="text" name="Email" required="yes" message="You must enter an email address" maxlength="20" size="20"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">Login:</div></td>
<td><cfinput type="text" name="Login" required="yes" maxlength="12" size="12"></td>
</tr>
<br>
<tr>
<td height="40" colspan="2"> <div align="center">
<input name="submit" type="submit" value="Add Agency">
</div></td>
</tr>
</cfform>
Thanks,
Robin
Here is the code:
<cfform name="addagency" action="AddAgency1.cfm" method="post">
<tr>
<cfif IsDefined('form.agency_name')>
<td class="FormTitleFieldName"> <div align="left">Agency Name:</div></td>
<td><input type="text" name="Agency_Name" value=<cfoutput>"#Agency_Name#"</cfoutput> maxlength="50" size="50"></td>
<cfelseif NOT IsDefined('form.agency_name')>
<td class="FormTitleFieldName"> <div align="left">Agency Name:</div></td>
<td><cfinput type="text" name="Agency_Name" required="yes" message="You must enter an agency name" maxlength="50" size="50"></td>
</cfif>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">
<p class="FormTitleFieldName">Address 1:</p>
</div></td>
<td><cfinput type="text" name="Address1" required="yes" message="You must enter an address" maxlength="50" size="50"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">Address 2:</div></td>
<td><cfinput type="text" name="Address2" maxlength="50" size="50"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">City:</div></td>
<td><cfinput type="text" name="City" required="Yes" message="You must enter a city" maxlength="20" size="20"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">State:</div></td>
<td><cfinput type="text" name="State" required="yes" message="You must enter a state"maxlength="20" size="20"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">Zip Code:</div></td>
<td><cfinput type="text" name="Zip" maxlength="10" size="20" required="Yes" validate="zipcode" message="You must enter a valid Zip Code"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">Contact:</div></td>
<td><cfinput type="text" required="yes" message="You must enter a Contact name" name="Contact" maxlength="20" size="20"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">Phone:</div></td>
<td><cfinput type="text" name="Phone" required="yes" validate="telephone" message="You must enter a valid phone number" maxlength="12" size="12"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">Email:</div></td>
<td><cfinput type="text" name="Email" required="yes" message="You must enter an email address" maxlength="20" size="20"></td>
</tr>
<tr>
<td class="FormTitleFieldName"> <div align="left">Login:</div></td>
<td><cfinput type="text" name="Login" required="yes" maxlength="12" size="12"></td>
</tr>
<br>
<tr>
<td height="40" colspan="2"> <div align="center">
<input name="submit" type="submit" value="Add Agency">
</div></td>
</tr>
</cfform>
Thanks,
Robin