When creating nested fields with Stimulus, I typically generate a template that can be dynamically appended to the view. With fields_for, I use a pattern like this:
fields_for "tasks[]", Task.new, index: "NEW_RECORD" do |task|
task.text_field(:name)
end
which outputs:
<input type="text" name="tasks[NEW_RECORD][name]" id="tasks_NEW_RECORD_name">
Issue
I'm trying to achieve the same dynamic behavior with Superform, but I'm not sure how to generate the nested fields template to add new elements dynamically. Can anyone provide guidance on how to replicate this behavior with Superform?
When creating nested fields with Stimulus, I typically generate a template that can be dynamically appended to the view. With fields_for, I use a pattern like this:
which outputs:
Issue
I'm trying to achieve the same dynamic behavior with Superform, but I'm not sure how to generate the nested fields template to add new elements dynamically. Can anyone provide guidance on how to replicate this behavior with Superform?