Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Script to add new Objects (Textbox, Dropdown List, Checkbox)

Avatar

Former Community Member
Is there a way to add input objects like Textbox, Dropdown List, Checkbox, etc. with javascript?



I want to have the contents of a subform constructed on initialize.



Thanks,



Kris
2 Replies

Avatar

Former Community Member
The easiest method is to create all of the objects you might need and set their 'presence' property to 'hidden'. Then in JavaScript you can turn each object on (as per your own condition) by setting the proprerty to 'visible'. This will only work on the client if the form is rendered as a dynamic PDF form.

I've also heard of an advanced methodology that uses the 'proto' object to define the different objects that might be needed and then the 'use' property can be used to invoke the applicable objects as needed (see the Designer ES Scripting Reference for more info). Unfortunately I don't have any first-hand expertise on using this method.

Avatar

Former Community Member
In your first approach, will the pdf form file size be representive of all the objects? If i need 40 Textboxes the files will be drastically bigger? Also can I just have one of each object and do a scripted object copy, define the object, and make visible? or do i need to make each object?



Thank you for your direction.. I am going to look into the Proto Object and use property some more.



I will post my outcome.



regards,



Kris