Expand my Community achievements bar.

How to change the text of the drop down list items?

Avatar

Level 3

The drop down list LIST includes 3 items, say, A, B, C.

I wish to change them into a, b, c.

this.resolveNode("LIST").rawValue only returns the default value of the drop down list.

but how can i identify these items and change their text seperately?

Also I'm trying to manipulate the contents of these items when a script is executed. I hope that the above identification can also help to add/remove the items.

Is there a manual that I can look up for the objects' path so that I won't be lost every time I'm doing this same location thing?

thanks!

6 Replies

Avatar

Level 10

Hi,

You can use clearItems() and addItem() methods to change the items in the dropdown.

There is an example here that populates the dropdown using script in the preOpen event. This looks at previous selections and changes the items in the dropdown accordingly: http://assure.ly/jcTahK.

Hope that helps,

Niall

Avatar

Level 3

thank you for your reply. it indeeds works!

Avatar

Level 3

Hi all!

I don't want to use addItem, cause I'll do databinding to each item.

Do you have any suggestion?

Now I only find out the way to read the text of each item , using getSaveItem(index) or boundItem(xfa.event.newText). But still don't know how to set the text.

Thanks in advance!

Avatar

Level 10

Hi,

The example above shows how you can also add a bound value using the addItem() method.

Also have a look at this example, where we are accessing the index and bound value: http://assure.ly/fYCuQ2.

Hope that helps,

Niall

Avatar

Level 3

thanks that gives me a hint but not the final solution.

i now use setItems to change the text. but the Item Values are also changed.

Initially I use value 1, 2, 3 to correspond to A, B, C. but after applying setItems, a, b, c have different value now (changed into a, b, c). i wish to also keep the same value as 1, 2, 3.

do you have any suggestion?

Avatar

Level 10

Hi,

It would be easier if you could share your particular form. It is difficult to generate generic examples that cover all scenarios.

If you can, upload your form to a file sharing site; publish it and then post the published URL here.

Niall