dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


advertisement
 

Automate Your Form Validation-2 : Page 2


advertisement

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Setting Up the Form
Open your editor of choice and construct the following form (see Figure 1):

Listing 1 contains the form code. Except for the JavaScript function to submit the form, it's very straightforward HTML. Try it live here.

<form method="POST" action="javascript:void(0)" onSubmit="return validator(this)"> <table> <tr> <td>Non - Empty</td> <td colspan="2"> <input type="text" name="txtNonEmpty" size="20"></td> </tr> <tr> <td>Integer</td> <td colspan="2"><input type="text" name="txtInteger" size="20"></td> </tr> <tr> <td>Float</td> <td colspan="2"><input type="text" name="txtFloat" size="20"></td> </tr> <tr> <td>US Phone</td> <td colspan="2"><input type="text" name="txtPhone" size="20"></td> </tr> <tr> <td>SSN</td> <td colspan="2"><input type="text" name="txtSSN" size="20"></td> </tr> <tr> <td>Zip Code</td> <td colspan="2"><input type="text" name="txtZip" size="20"></td> </tr> <tr> <td>Credit Card</td> <td><input type="text" name="txtCC" size="20">Type <select size="1" name="txtCCType"> <option selected value="1">Visa</option> <option value="2">MasterCard</option> <option value="3">Discover</option> <option value="4">American Express</option> </select></td> </tr> <tr> <td>Date</td> <td colspan="2"><input type="text" name="txtDate" size="20"></td> </tr> <tr> <td>E Mail</td> <td colspan="2"><input type="text" name="txtEMail" size="20"></td> </tr> <tr> <td>&nbsp;</td> <td colspan="2"><input type="submit" value="Submit" name="B1">&nbsp;&nbsp;&nbsp; <input type="reset" value="Reset" name="B2"></td> </tr> </table> </form>



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date