Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

How to add form fields dynamically?

Avatar

Level 2

Hi,

Can anyone please tell me how to add fields in a form dynamically(like create a Text Field) using javascript/FormCalc(the way we use document.createElement to create html fields dynamically).

Currently we are putting all the fields in the form and make only those fields required as visible. On change of logic/scenario, the appropriate required sections are made visible and all the other fields/pages are made invisible?

Thanks,

Muniyaraj

1 Reply

Avatar

Level 10

Hi,

The way you are doing it at the moment would work well where there are different objects required (depending on the logic).

Where you want copies of existing objects, you could wrap these in a subform and then use the addInstance command to create a repeat of the subform (and its contents). For this to work, you would need a flowed subform/page layout and the form would need to be saved as dynamic.

Check out the help file.

Niall