Expand my Community achievements bar.

How do I use a drop-down box to turn on a radio button?

Avatar

Level 2

I have a dynamic form with a drop-down box containing selections 1, 2, 3, and 4; later in the form I have a radio button group with two radio buttons labeled "pass" and "fail".

I would like to have drop-down selections 1 and 2 automatically select "fail" and 3 and 4 automatically select "pass" in the radio button group, with the option of the user changing this with a warning message.

Any help is greatly appreciated.

Thx

Drew

3 Replies

Avatar

Level 10

Hi,

you can use this JavaScript in the change event of your drop down list.

var sel = xfa.event.newText;

RadioButtonGroup.rawValue = (sel === "1" || sel === "2") ? 1 : 2;

Avatar

Level 2

Thanks radzmar for the reply.

What do I have to change in the script to make it work?  I've changed the name of the RadioButtonGroup, but what is the "newText" referencing? Does that need to be changed as well?

Avatar

Level 10

Hi,

the newText is the value a drop down list gets in the moment you select any of its items.

The newText can only be referenced in the change event.

My sample checks if you selected either item "1" or "2".

If so, it changes the rawValue of your radio button group to 1, which means that the first element is activated.