Change Dropdown Checkbox based on other component value

Avatar

Avatar

bokenrosie

Avatar

bokenrosie

bokenrosie

19-09-2016

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,

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372
_Bruce_Robertson
MVP

19-09-2016

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

Answers (3)

Answers (3)

Avatar

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372
_Bruce_Robertson
MVP

22-09-2016

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

Avatar

Avatar

bokenrosie

Avatar

bokenrosie

bokenrosie

20-09-2016

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

Avatar

Avatar

bokenrosie

Avatar

bokenrosie

bokenrosie

20-09-2016

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