Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote forms with blank required field still submitting. #408

Open
ericdfields opened this issue Mar 25, 2015 · 2 comments
Open

Remote forms with blank required field still submitting. #408

ericdfields opened this issue Mar 25, 2015 · 2 comments

Comments

@ericdfields
Copy link

I've got one required field in my remote form. It's a select field. If I don't select something and try to submit, it still does an ajax post. Clearly visible in Inspector > Networks.

From what I've read, the ajax:aborted:required event should be fired and the form should not submit. Am I wrong?

I've tried binding to that event and it doesn't seem to get fired.

Here's a basic cross-section of my form with all the useful details:

<form action="/object/123" data-remote="true" method="post">
  <select required="required">
    <option>option 1</option>
    <option>option 2</option>
    <option>option 2</option>
  </select>
  <input type="submit" value="Save">
</form>

Thanks for any help.

@rafaelfranca
Copy link
Member

required select has one particularity. To it be valid you need a blank option. I don't know if we should check too. http://www.w3.org/TR/html5/forms.html#the-select-element

@ericdfields
Copy link
Author

I see. That does complicate things, but it seems like it'd be worth it. I think we'd have to adjust the logic here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants