GrassHopperPebbles.com Demos

JQuery Plugins

imValidateForm 1.1 - Basic Example

The following example shows how to use the imValidateForm plugin. I generally keep my validation rules in a separate .js file. The rules are formatted as a Json object. This Json object displays the rules that are applied the registration form below.

var valMapReg1 = { "fields":
[{"id": "first_name", "label" : "First Name", "rules":
                        [{"name": "hasValue"}]
                          },
{"id": "last_name", "label": "Last Name", "rules":
                        [{"name": "hasValue"}]
                          },
{"id": "address1", "label": "Street Address", "rules": 
                        [{"name": "eitherOr", "fields": [
                                   {"id" : "address2"}]}]
                          },
{"id": "city", "label": "City", "rules":
                        [{"name": "hasValue"}]
                          },
{"id": "states", "label": "States", "rules":
                        [{"name": "hasValue", "exclude": "0"}]
                          },									
{"id": "zip_code", "label": "Zip Code", "rules":
                        [{"name": "hasValue"}, {"name": "isNum"}]
                          },
{"id": "email", "label": "Email Address", "rules":
                        [{"name": "hasValue"}, {"name": "isValidEmail"}, {"name": "isEqual", "fields": [
                                                                      {"id" : "tConEmail"}]}]
                          }]
}

When testing this form, first click on the submit button without entering any information. View the source for this page to view how to use the plugin. For documentation about the imValidateForm plugin, view the blog post.

First Name*:
Last Name*:
Address1*:
Address2:
City*:
State*:
Zip/Postal Code*:
Home Phone:
Email Address*:
Confirm Email:
Required fields are marked with an (*)

Tags

, , , ,