views:

24

answers:

1

With an input type=email, Safari won't let the form be submitted if there's not a valid email address. But there's no feedback from the browser at all to let the user know why the form stopped working.

Is there anything to be done other than writing some Javascript to validate the input (which kind of ruins the point of using type=email)?

A: 

Do styles show up?

input[type=email]:invalid {
    background-color: red;
}

If you resort to JavaScript, you don't need it to do the validation, you just need to hook into the HTML5 constrain validation API, either hook the invalid event or call element.validity.valid as you loop through the form on the submit event. There's a nice introduction to the whole thing on A List Apart: Forward Thinking Form Validation

robertc