0

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.

1

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).

  • 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 Leedy Dec 17 '11 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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