-
Notifications
You must be signed in to change notification settings - Fork 369
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
Unique ids for checkbox + label in dynamic groups #214
Comments
@johngrimsey Thanks for pushing the envelope :-) I'm not sure if I do fully understand your problem. Could you please show some HTML and explain what you're trying to achieve? Currently all element groups of an form array do not get an id as this would lead to invalid markup. That's why I originally added |
Sure! In this example, clicking any of the labels in the second group results in the corresponding checkbox of the first group being selected rather than the checkbox next to the clicked label. Is the |
@johngrimsey Ok thanks. Actually the focus behavior is fully controlled by the browser. There should be no need for you to use |
All the markup's coming from the The problem appears to be the checkboxes inside of dynamic FormGroups don't receive unique ids. So the browser is matching the first occurence in the DOM of an (This behaviour is expected as its simply the browser adhering to the principle of unique |
@johngrimsey Ok, I think I do understand now. The solution would be to wrap all checkbox inputs in |
@johngrimsey Yep, that should do it. |
Good plan, I was hoping that'd be the answer :) |
Possible it's my incorrect usage...
I have a dynamic array of FormGroups each containing a DynamicCheckboxGroupModel. Each checkbox has an id (for day of the week).
When rendered click events on labels correctly activate the first element on the page with matching id which sometimes is the wrong element. My problem is that if I create unique ids I can't bind data to the form without quite a lot of work to match data to fields via dynamic ids.
We may need dynamically generated unique ids?
Thanks for all your work on this, really great library.
The text was updated successfully, but these errors were encountered: