Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am using a Client Validation module for my webforms.

I am seeing a "Please enter an email address" pop up bubble next to the email text field when an incorrect email is entered. I am not quite sure where this is coming from...? Can anyone shed some light?

I would prefer this functionality:

Submitting the form with an empty email field displays a different error message to when an invalid email is entered eg. http://validation7.ubu001.attiks.com/node/1?utm_medium=atix&utm_source=cv7b

share|improve this question
add comment

1 Answer

Know this was asked a little while ago, but started investigating and found a "solution". Apparently when Webform has a form component with type "Email" it sets the input type to "email". On browsers IE8+ and modern browsers (Chrome, FF) there is an automatic, browser-side verification on these fields. It's nothing to do with the script. It seems to be an html5 "feature", see http://stackoverflow.com/questions/9399528/disable-form-validation-in-browser.

Two options:

  1. Don't use the "Email" type in Webforms. This kind of breaks the ability to use form values as "To" or "From" emails in the Webform Emails feature, so it's not great.

  2. Add the novalidate rule to the <form> generated by Webform. I do so via a custom hook:

    function mymodule_form_alter(&$form,&$form_state,$form_id) {
    
      if(strstr($form_id,'webform') !== FALSE) {  
        // prevent html5 validation, i.e. on input type="email" fields  
        form['#attributes']['novalidate'] = '1';  
      }
    
    }
    

This is just if you want to remove it. Now you can use Webform clientside validation module to set custom messages. Or you can style like here: http://stackoverflow.com/questions/5713405/how-do-you-style-the-html5-form-validation-messages

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.