Expand my Community achievements bar.

How to Add and Remove fields or table

Avatar

Level 1

I have a new form created.

i want to duplicate particular fields. like

when user click "Add" button, the desired field should be added below the field.

and next to the field there should be "Add" and "Remove" buttons.

when click on "Remove" button, the field should be deleted.

see the attachment once.

Untitled-1.jpg

1 Reply

Avatar

Level 1

I have a table with the following row:

screengrab1.jpg

The structure in the Hierarchy panel is:

screengrab2.jpg

To add another row to this table I use the following on the ADD button:    

previousNames.Row1.instanceManager.addInstance(1);   

To remove a specific row from this table I use the following on the REMOVE button:   previousNames.Row1.instanceManager.removeInstance(this.parent.parent.index);

**using .removeInstance(1); removes a row but not the specific one selected**

To add or remove an entire section, eg a complete table:

Wrap the table/section of content in a subform.

Make sure your add/remove buttons are also included within the subform.

Select the subform in the Hierarchy panel.

Go to the Binding tab in the Object panel.

Check the box 'Repeat Subform for Each Data Item' - Min Count should be 1

Add button:  _subformName.addInstance(1);  

Remove button:  _subformName.removeInstance(subformName.index);

(where subformName is the name of YOUR subform)

I hope this helps. I was looking for this solution for weeks and was having to do trial and error of any solutions I did find online until I got one that worked. I've included the screen grabs so you can see how it relates to my structure and amend it to suit yours accordingly.