1

We are updating our forms to use the correct html 5 input types. Our entry field has the following:

<input name="AlternateEmailAddress" class="validation-error" id="AlternateEmailAddress" aria-invalid="true" aria-describedby="AlternateEmailAddress-error" type="email" value="" autocorrect="off" autocomplete="off" autocapitalize="off" multiple>

We are also using jQuery Validate, version v1.15.1 because we need to support older browsers, and have a custom plugin for handling multiple email addresses. The rules setup are as follows

AlternateEmailAddress: {
    multipleemail:true,
    maxlength:1000,
    asciionly:true
}

multipleemail and asciionly are our custom values. multipleemail is similar to jQuery validation plugin multiple email addresses.

For some reason, though, jQuery Validate does the single email validation, even though we have it turned off. It is using their default text, not the text that we are specifying.

Is there a way to turn type="email" validation off, or is there a fix for when we use the multiple attributes?

Sparky
  • 98,165
  • 25
  • 199
  • 285
Chad Yost
  • 53
  • 7

1 Answers1

2

Is there a way to turn type="email" validation off, or is there a fix for when we use the multiple attribute?

The simple fact that you have a type="email" attribute automatically triggers the email validation rule in jQuery Validate.

You can disable it by defining this rule as false in the .validate() method.

....
AlternateEmailAddress: {
    email: false,         // <- disable email rule
    multipleemail: true,
    maxlength: 1000,
    asciionly: true
    ...

DEMO: jsfiddle.net/196bdo8g/

Sparky
  • 98,165
  • 25
  • 199
  • 285