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.

Question on drop down list value to determine display in text field

Avatar

Level 2

Hi I have just started using livecycle to develop simple forms for the office. I have been fairly successful so far,

but I have one question. How can i use the value a user selects from a drop down list to have a predetermined value displayed in a text field?

thanks

3 Replies

Avatar

Level 9

Hello Samuel ,

As far as I understand your question , you want to display the same value as the user selects from the dropdown lists in the textfield.If this is the case then the following script might help you . What you need to do is to capture the value which the user selects from the dropdown list .Then you have to assign the value to that particular textfield.Here you have to use change event as it helps when some changes has been made to the dropdownlist i.e. when the user selects some value from the dropdown list.

form1.page1.pageSelection::change - (JavaScript, client)

    var newVal = this.boundItem(xfa.event.newText);
    form1.page1.TextField1.rawValue = newVal;
    xfa.form.recalculate(true);

Here recalculate is used because  it Forces a specific set of scripts located on calculate events to execute. The specific events can ...pending  calculate events or all calculate events. But I tested it without using recalculate , it works fine . However you should use recalculate.

Hope it helps.

Thanks.

Bibhu.

Avatar

Level 2

thanks very much Bibhu_Nayak for your help ..really. But allow me to clarify the question..

Lets say I have a drop down list and a text field on a form

In the drop down list, I might have values such as Color1, Color2, Color3, Color4, and so on. where for example...

Color1 corresponds to blue,

Color2 corresponds to red,

Color3 corresponds to white,

Color4 corresponds to green

So if the user chooses Color1 from the drop down menu, the value "blue" should be automatically displayed in the text field

if the user chooses Color2 from the drop down menu, the value "red" should be automatically displayed in the text field

if the user chooses Color3 from the drop down menu, the value "white" should be automatically displayed ....etc.

I hope I'm really clear on what I'm trying to achieve. I need help with this.

thank you.

Samuel (newbie)

Avatar

Level 10

yourTextField.rawValue = dropDown.getDisplayItem(dropDown.selectedIndex);     // This populate whatever selected in the DDL

yourTextField.rawValue = dropDown.getSaveItem(dropDown.selectedIndex);     // This populates the value of the selected DDL

Choose one of the option for your need.

Nith