The plugins site is currently in development.
We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.
Form Validation With Hints
Client-side form validation.
Instructions
1. Add jquery.form-validation-and-hints.js to your scripts directory and include it in the HTML which must also contain a version of the JQuery Library.
2. In jquery.form-validation-and-hints.js set the classprefix that you will use to link form elements in the HTML with validation rules in the JS (default is "verify").
3. Add the class "required" to wrap any field that should pass through a validation rule before submiting the form. Use any of the classes for predefined validation rules (verifyInteger, verifyURL, verifyMail) in the input inside the required wrapper.
4. Create your own validation rules in jquery.form-validation-and-hints.js declaring them inside the isTypeValidExt function.
<div class="field required">
<p><label>Email</label> <input type="text" class="verifyMail" name="email" /></p>
</div>
Optional
- Use the class "iferror" to add the information text to be displayed next to the field when a validation error ocurrs after submiting the form.
- HINTS: Use the attribute title="*Hint" to add text to be displayed inside the field. This hint won't be submitted as a value and will disappear when the user makes focus on that form element. The value for the attribute title should start with * to be considered by the script as a hint.
<div class="field required">
<p><label>Email</label> <input type="text" class="verifyMail" name="email" title="*mail@example.com" /></p>
<p class="iferror">This field is required</p>
</div>
Predefined validation rules
verifyText, verifyInteger, verifyURL, verifyMail, verifyMultipleWords.
