nested_form icon indicating copy to clipboard operation
nested_form copied to clipboard

nested_form shows extra fields after error messages

Open Mingus85 opened this issue 9 years ago • 1 comments

I'm using simple_nested_form_for to build a form with nested fields. When I press submit, I get the correct params hash, and validation seems to work. When after some validations do not pass I re-render the form via the create action, however, the nested fields are displayed incorrectly. The same nested fields are shown multiple times.

Also, in my simple_fields_for the FormBuilder index is shown as a semi random number such as 1454793731550, whereas after re-rendering it is displayed in normal increments 0-n.

Mingus85 avatar Feb 06 '16 21:02 Mingus85

@Mingus85 Can you please share your code?. especially, the create action of the controller. It is just to know what you are exactly trying to do. And the last part is because , Using the nested form, we add fields dynamically, so for the first time when form is rendered, we donot initialize any objects of the child class. The FormBuilder object is yielded when usingform_for or fields_for. and When these values are submitted to server, we initialize objects so next time when it is re-render it is displayed with its object ids.

Ashviniv avatar Sep 22 '16 17:09 Ashviniv