NULL
NULL

Reputation: 1589

jquery validation message

i have 3 form input text for phone number. currently i am validating each input text for a digit.

i have an input message for each individual input text. instead of doing this:

phone1: {
        required: true,
        maxlength: 3,
        digits: true

},  
phone2: {
        required: true,
        maxlength: 3,
        digits: true

},
phone3: {
        required: true,
        maxlength: 4,
        digits: true

}

phone1:"enter value!.",
    phone2:"enter value!.",
    phone3:"enter value!."

i will like to only show one single message for all three fields. right now, i have 3 messages displaying on the screen. is there a way to only show just one until the user completes all required fields.

phone1,phone2,phone3:

Upvotes: 0

Views: 2284

Answers (2)

Kyle Butt
Kyle Butt

Reputation: 9760

You probably want to use groups along with a custom errorPlacement function.

see here: http://docs.jquery.com/Plugins/Validation/validate#toptions under the heading "groups"

Upvotes: 2

Vinodh Ramasubramanian
Vinodh Ramasubramanian

Reputation: 3185

You may want to set the onfocusout to false and onsubmit to true so that all validations are done at the time of submit.

If you are talking about having one single message irrespective of which one fails. You may setup a validation rule that validates all of them but marks just one of the fields to be invalid (e.g. Phone1).

Upvotes: 0

Related Questions