-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Mulitple Nested forms in same view? #8
Comments
I understand this feature will be merged from the live pull-request: |
@iangullo It appears that you can do this with Per the example in the docs:
Or something like that. Maybe I've misunderstood the problem, but it seems to be working for me. |
@ferrisoxide I don't have time to test at the moment, but without the PR I was unable to do something like this (which is what I believe this issue was getting at):
|
Ah, I didn't distinguish between the selector-value data attributes. Both of my nested forms have a div wrapper that looks like this:
Not sure why, but it's working fine with two sets of nested form in the same form. 🤷 |
Hi bro @brodyhoskins , may I see your 'tag_form' or 'picture_form' files? I have a problem with the button remove in the nested form |
@agamstawn Sure, it looks like: <div class="tag-form-wrapper row gy-2 gx-3 align-items-center mb-4" data-new-record="<%= f.object.new_record? %>">
<div class="col col-sm-4">
<div class="input-group">
<%= f.text_field :name, wrapper: false %>
</div>
</div>
<div class="col-auto">
<%= f.hidden_field :_destroy, wrapper: false %>
<%= link_to icon('solid', 'trash', 'Remove'), '#', data: { action: 'nested-form#remove' }, class: 'btn btn-light ml-2' %>
</div>
</div> |
I'm trying to add 2 nested-form's to my app, and the problem I'm having now is that the 2nd link_to 'Add' data: {action: 'nested-form#add' } just adds to the first nested-form. How would this work if both instances of nested-form-controller have the same name/id? |
Hi, trying to embed two nested forms in the same view (tags and pictures).
Is that a possible thing to with this component as it is today?
The text was updated successfully, but these errors were encountered: