Expand my Community achievements bar.

SOLVED

Change Dropdown Checkbox based on other component value

Avatar

Level 1

I'd like to put a check in a checkbox if a dropdown next to it has been used.  Let me illustrate:

I have a form that is sent a long with a number of events to subscribers.

It would have a checkbox next to what is being sent. 

[ ] Enclosed is your {dropdown list with multiple policy names}

[ ] Enclosed is a check for {dropdown for various reasons}

It would be great if I could put a check in the checkbox if the user activates and chooses a value in the associated dropdown list.

So if I use the above example and use the second dropdown because they are sending a refund check it would put the check in the CheckBox10 object once I choose the "policy refund" item from that list (or any item not the default value).

Much appreciate any and all advice.

Thanks for looking,

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Assuming you are using a checkbox with the default on/off values of 1 and 0, then this JavaScript code in the calculate event of CheckBox10 should do it;

     DropDownList1.isNull ? 0 : 1;

Just change the DropDownList1 to match the name given to you drop down control.

Regards

Bruce

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

Hi,

Assuming you are using a checkbox with the default on/off values of 1 and 0, then this JavaScript code in the calculate event of CheckBox10 should do it;

     DropDownList1.isNull ? 0 : 1;

Just change the DropDownList1 to match the name given to you drop down control.

Regards

Bruce

Avatar

Level 1

Hi Bruce,

Thanks for the reply.  I thought it did not work but then realized that it does not change the checkbox until I click into another object.  Is there a way to triger it when they first go to the dropdown?  It is already set on "Commit on Select"  When I change that value to Exit it does not work.  Thanks

Avatar

Level 1

Wait, my bad.  I copied an element and forgot to rename it.  Works like a charm.  Thanks.

Avatar

Level 10

Hi,

Try 'pushing' the value across from the change event of the drop down list, with some code like this JavaScript;

CheckBox10.rawValue = (xfa.event.newText === "") ? 0 : 1;

Assuming your empty value in the drop down is the empty string.

Regards

Bruce