Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

DropDown value depending on Textfield

jck_drmjn
Level 5
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
_Bruce_Robertson
Correct answer by
Level 10
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

0 Replies
Niall_O_Donovan
Level 10
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

jck_drmjn
Level 5
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?

_Bruce_Robertson
Correct answer by
Level 10
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

_Nith_
Level 10
Level 10

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

Nith

jck_drmjn
Level 5
Level 5

Hi Bruce,

Thanks a lot. I wanted exactly this.

jck_drmjn
Level 5
Level 5

Hi Nith,

Created a sample. Great! I have got answer.

Thanks again, Nith.