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

One pair of radio buttons to control multiple text objects - Designer 8.0


Not applicable
Greetings - a big thank you in advance for any assistance. I have often found answers to my problems on this forum, but have been unable to find an answer to the following.

The short of it - is it possible to make a pair of radio buttons control the visibility of multiple text objects with the same name(I have had success in manipulating only a single text object with one pair of buttons)?

The long of it - I am trying to make a form bilingual based on the value of a radio button group to control the visibility of the text object in the selected language. When the user selects the language they wish to see, all the text objects in the form switch to that language. I am working with a dynamic PDF.

I have succeeded to a very limited extent in manipulating one text object by overlaying text objects in both languages, setting one object to "invisible" as default, and controlling that text objects visibility with the following JavaScript in the click event of the radio button group:

----- form1.#subform[0].ENG_JPN::click: - (JavaScript, client) -------------------------------------

if (ENG_JPN.rawValue == 1)///1 equals the value of on

{English.presence = "visible";}


{English.presence = "invisible";}

if (ENG_JPN.rawValue == 2)///2 equals the value of on

{Japanese.presence = "visible";}


{Japanese.presence = "invisible";}


The problem is I need to manipulate the visibility of all text objects with the same name on the form with a single radio button group. I have tried writing the code as one does for the sum of a repeating field, ie. English[*].presence etc. however I get a C++ error in preview.

Any ideas are greatly appreciated. I am truly stumped - thank you for your time.
0 Replies


Level 10
To access objects with the same name you need to deal with occurance numbers. If your object is called TextField then the 1st occurance will be TextField[0], the second occurance will be TextField[1] etc.....

The issue is that the [] in javascript are interpretted as an array element so you have to use the syntax: xfa.reolveNode("string") to get to your object names. In your case you would use:

xfa.resolveNode("TextField[1]").presence = "visible"

This string syntax allows you to use a var to hold the index number and is very useful with for loops where you want to set large numbers of objects. So if the index was held in the var i then your syntax would be:

xfa.resolveNode("TextField[" + i + "]").presence = "visible"

If the objects are in a repeating subform then the occurance numbers are on the subform and not the object. You can always get the expression to use by app.alert(objectname.somExpression). This will return the expression that you need to create.

Make sense?


Not applicable
Hello Paul,

Yes, perfect sense! Thank you very much for such a clear explanation. I had produced a stand-in work around by naming each text object something different and writing an individual script for each. Very long, hard to identify errors, and frustrating to manage.

Thank you for your solution.