Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I wrote a simple form, including text field, textarea, select and some validating by WP_error. When I try to submit the form without filling text field or textarea, I got a popup tip pointing the blank text field, it says "please fill in the field". This is different from the error message I wrote, and I didn't write any ajax for validating-- my validating messages comes after the form submitted and redirected. Is this validating part of WP3.3 new feature? or it's a firefox feature?

Edit: Thanks to joseph, found the reason-- it's html5 new feature-- required attribute

The required attribute applies to all form controls except controls with the type hidden, image inputs, buttons (submit, move-up, etc), and select and output elements. For disabled or readonly controls, the attribute has no effect.

share|improve this question

1 Answer

up vote 1 down vote accepted

Could you please show us your code or better yet provide an example? Sight unseen, my preliminary thought based on your description is that you are using some of the new HTML5 form elements and/or attributes. In particular, the required attribute would cause the error that you are seeing depending on the browser that you are viewing the page in (Firefox in this case).

share|improve this answer
thanks for pointing the html5, highly likely it is guilty for this. I do use 'required' in all the fields, but only text fields and textarea got validated by this thing. How can I get select fields validated by this? – Jenny Dec 16 '11 at 14:56
just found the info-- required attribute doesn't work with selected fields – Jenny Dec 16 '11 at 15:13
The required attribute does work with select fields, at least in my testing. You just need to make sure that your first <option> has an empty value. – Joseph Dec 17 '11 at 22:51

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.