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.
SOLVED

Populate a textfield with the dropdown selection

Avatar

Former Community Member

Goo day,

I have one dropdown and a textfield inside a table with one row and an Add button.

The row is repeatable, now when I select a value from the dropdown, say "23" and it populates the textfield say with "Jordan".

I then click the addButton to add a new row, now I select "7" in the new dropdown and its suppose to populate the new textfield with "David Villa" ,

instead of doing that it replaces what was on the initial textfield("Jordan") with David Villa leaving the new textfield empty.

Can someone please help me.

Another thing, I have to select twice for the dropdown to fire, why is that?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

First thing: I suspect that you have the script in the change event, but are using .rawValue for the test. With dropdowns I would tend to use the exit event and use .rawValue.

In relation to the textfield, you are probably using too full a reference, like "Row1.usersName". If you just use "usersName, eg the name of your textfield, then Acrobat/Reader will use the particular instance of the textfield in the same row as the dropdown.

Hope that helps,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

First thing: I suspect that you have the script in the change event, but are using .rawValue for the test. With dropdowns I would tend to use the exit event and use .rawValue.

In relation to the textfield, you are probably using too full a reference, like "Row1.usersName". If you just use "usersName, eg the name of your textfield, then Acrobat/Reader will use the particular instance of the textfield in the same row as the dropdown.

Hope that helps,

Niall

Avatar

Former Community Member

Thank you Niall, you were spot on. Thanks once, much appreciated.