AnsweredAssumed Answered

Set choice field value with two other choice fields

Question asked by jmedina on Jul 19, 2018
Latest reply on Jul 20, 2018 by jmedina

Hello,

I am trying to set a choice field on a 2013 form using .js similar to this thread: How to set value in Choice field based on value of other choice field , but I need to be able to change the drop down with a separate field. Here is the example:

Basically, if the information is correct, and they click "Yes", the Approval column will select "Approved". If the information is not correct the Close site? will show. If they need to close the site and select "Yes" on the close site column, the Approval column will changed to "Closed Site". 

 

My Variables are set up as such:

Information Correct Column = varYesNo

Close Site? column = varClose

Approval column - varApproval

 

I can get one column to change the Approval column, but I have not been able to get them both to work.

 

Here is my code:

NWF.FormFiller.Events.RegisterAfterReady(function
() {

 

NWF$('#'+varYesNo).change(function(){

 

if (NWF$('#'+varYesNo).val

("Yes")){

 


NWF$('#'+varApproval)

.val ("Approved");

 

}

 

});


NWF$('#'+varClose).change(function(){

 

if
(NWF$('#'+varClose ).val
("Yes")) {

NWF$('#'+varApproval).val(‘Closed Site’);

)
});

});

 

The form just spins and won't let me preview when I add the NWF$('#'+varClose).change function.

Outcomes