Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

DropDown value depending on Textfield

Avatar

Level 5

Dropdown value will come from two text fields (TextField1+TextField2), intigrating one value of dropdown.

And also TextField1 and TestField2 will increase by clicking on add row button.

In this case how can I get code?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi

In the preOpen event of your dropdown you can add the items to your dropdown with the following code;

var dropdownitems = [];

var rows = xfa.resolveNodes("Row[*]");

for (var i = 0; i < rows.length; i++)

{

    dropdownitems.push(rows.item(i).TextField1.rawValue + " " + rows.item(i).TextField2.rawValue);

    dropdownitems.push(rows.item(i).index);

}

this.setItems(dropdownitems.join(","), 2);

This assumes the text fields are called TextField1 and TextField2 are in repeating subform called “Row”.

The value of the dropdown will become the index of the row containing the text fields.

This assumes your users are using Reader 9.0 or above.  If not you will have to do something similar but the with clearItems and addItem methods.

Regards

Bruce

View solution in original post

6 Replies

Avatar

Level 10

Hi,

There are a couple of issues. (1) scripting the items in the dropdown. (2) looping through the repeating instances.

I can't get to LCD Designer at the moment but have a look at this: http://assure.ly/jcTahK.

I "think" this might also help: http://assure.ly/rwvJxM.

Niall

Avatar

Level 5

Thanks for your kind help.

Actually I want dropdown value will be depended on textField. User will type in text field. So dreopdown value is variable.

DropDown value = TextField1+Textfield2.

How can I do this?

Avatar

Correct answer by
Level 10

Hi

In the preOpen event of your dropdown you can add the items to your dropdown with the following code;

var dropdownitems = [];

var rows = xfa.resolveNodes("Row[*]");

for (var i = 0; i < rows.length; i++)

{

    dropdownitems.push(rows.item(i).TextField1.rawValue + " " + rows.item(i).TextField2.rawValue);

    dropdownitems.push(rows.item(i).index);

}

this.setItems(dropdownitems.join(","), 2);

This assumes the text fields are called TextField1 and TextField2 are in repeating subform called “Row”.

The value of the dropdown will become the index of the row containing the text fields.

This assumes your users are using Reader 9.0 or above.  If not you will have to do something similar but the with clearItems and addItem methods.

Regards

Bruce

Avatar

Level 10

I just created a sample PDF for you. Share your email with me: nithiyanandam.dharmadass@igatepatni.com

Nith

Avatar

Level 5

Hi Bruce,

Thanks a lot. I wanted exactly this.

Avatar

Level 5

Hi Nith,

Created a sample. Great! I have got answer.

Thanks again, Nith.