Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

How do I autopopulate a text field based on user input?


Level 1

I'm creating a pdf that has both a shipping address and a bill-to address. I want to add a check box where a user can indicate whether the bill-to is the same as the ship-to address. If yes, I would like the address fields to autopopulate based on the information already entered for the ship-to address fields. What should the script look like?

1 Reply


Level 1

I think you can do it this way: 

Create the billing address fields first, then bind them to the ship-to address, then make the ship to address hidden.

Then run an action so that if the yes check box is marked then the ship-to address fields become visible. 

Create another set of ship-to address field that are not binded to the billing address fields and hide them.

Run another action so that if the no check box is marked, then those ship-to address fields become visible, and they are empty.

It should work that way.....however, there could be another way to do it that is easier, I don't know.