You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
I'm trying build a nested form using simple_nested_form_for. I want to create a counter that changes incrementally with each added field. As following: Field 1, Field 2, etc.; field_1_id, field_2_id, etc.
I expected to be able to use the FormBuilder Object's index (e.g. f.index). This does start with '0', but the next iteration then becomes a semi-random number like '1454666984988'.
I also trield putting the nested field code in a partial and then counting the number in the collection using partial_counter + 1. Unfortunately, the counter does not seem to increase incrementally at all, and just yeilds yields Field 1, Field 1, etc.....
Is there a way to do this in Ruby, or will I have to use javascript?
The text was updated successfully, but these errors were encountered:
I just came across this as well. I believe if it's not built into nested_form (which perusing the source, I'm thinking it's not), you'll need to do it in JS.
Hi,
I'm trying build a nested form using
simple_nested_form_for
. I want to create a counter that changes incrementally with each added field. As following: Field 1, Field 2, etc.;field_1_id
,field_2_id
, etc.I expected to be able to use the FormBuilder Object's index (e.g.
f.index
). This does start with '0', but the next iteration then becomes a semi-random number like '1454666984988'.I also trield putting the nested field code in a partial and then counting the number in the collection using
partial_counter + 1
. Unfortunately, the counter does not seem to increase incrementally at all, and just yeilds yields Field 1, Field 1, etc.....Is there a way to do this in Ruby, or will I have to use javascript?
The text was updated successfully, but these errors were encountered: