-
Notifications
You must be signed in to change notification settings - Fork 196
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
Form validation does not respect required radio buttons #1864
Comments
Thanks a lot for the detailed bug report. It would be helpful if you could provide a snapshot of the rendered HTML as well. Thanks. |
Are you using https://github.com/ember-bootstrap/ember-bootstrap-constraint-validations, or just plain ember-bootstrap? |
@simonihmig I am using plain ember-bootstrap @jelhan I think this is the snapshot you were looking for. Let me if you would like to see anything else |
Sorry. I was not precise. I meant a snapshot of the HTML elements the Glimmer VM creates. The issue is likely that HTML is not as you expect. |
Here is the HTML for the complete form (previously i shared only the radio button group). The radio button group starts at the label 'Category'
|
This seems to be caused by missing Doing some tests I noticed that a form is submitted even if it has a If a Radio inputs have a PR adding the |
If i am explicit about the 'name' attribute, required radio buttons are respected. When i changed my template to the below, all worked as expected. I poked around in the ember-bootstrap source code a bit, but i couldn't find where to add some routine that would make the |
Glad to hear that you found a solution to unblock your case. I think it's up to the form control to set it. I noticed that the
But a ember-bootstrap/addon/components/bs-form/element.hbs Lines 80 to 101 in 4ec513d
It seems that not setting a Defaulting to This might be considered a breaking change. I feel it would be good to land it as part of upcoming major. Will add it to v6 tracking issue. I don't have much time for open source currently. Does this input makes you feel comfortable continue working on this bug? I feel next steps are:
|
I don't think we should treat it as a breaking change. It's adjusting the HTML markup rendered by Ember Bootstrap with the one expected by Bootstrap. And it fixes a bug with browser's form validation. Setting the |
I have a simple BS Form, and i've set the 'required' property on a group radio button. When I click the Submit button without making a selection from the radio button group, the form does not display the expected 'required' message, and the onSubmit handler is called. I would expect the form to fail validation and the
submit
handler not to be called. It doesn't matter if i put 'required' on the form.element control or on the el.control.The 'required' property does appear in the rendered markup:
A simplified version of the form
Output from
ember bootstrap:info
:The text was updated successfully, but these errors were encountered: