I am trying to update dropdown value based on another dropdown value.
Eg: I have a choice column TestA which has Yes and No as radio buttons and another column TestB which also has radio buttons with Yes and No values. If I select Yes in TestA, it should also check Yes in TestB. Any possible ways?
Thank you! Appreciate your response!
Best answer by Garrett
Hi @Var560121
This is possible in Classic Form through the usage of JavaScript.
In the Classic Form. Configure the Choices control as below
Assign the Name and the Choices.
IMPORTANT: In the Advanced section. Set “Store Client ID in JavaScript variable” to Yes and provide a JavaScript variable name for it. I named is as “jsTestA” and “jsTestB”. The variable name is case-sensitive.
//This is the jsTestA on Change event handler. //This function is triggered each time the radio button changes value NWF$("#" + jsTestA).change(function() {
//Here we retrieve the current value of jsTestA //The variable "varTestA" stores the value var varTestA = NWF$("#" + jsTestA + ' input:checked').val();
//Here we set the value for jsTestB if (varTestA == "Yes") { // jsTestB is YES when jsTestA is YES NWF$('#' + jsTestB).find('input:radio[value="Yes"]').prop("checked",true); } else { // jsTestB is NO when jsTestA is NO NWF$("#" + jsTestB).find('input:radio[value="No"]').prop("checked",true); } }); });
Clear code without the comments
NWF.FormFiller.Events.RegisterAfterReady(function() { NWF$("#" + jsTestA).change(function() { //Get Value var varTestA = NWF$("#" + jsTestA + ' input:checked').val(); //Set Value if (varTestA == "Yes") { NWF$('#' + jsTestB).find('input:radio[value="Yes"]').prop("checked",true); } else { NWF$("#" + jsTestB).find('input:radio[value="No"]').prop("checked",true); } }); });
This is possible in Classic Form through the usage of JavaScript.
In the Classic Form. Configure the Choices control as below
Assign the Name and the Choices.
IMPORTANT: In the Advanced section. Set “Store Client ID in JavaScript variable” to Yes and provide a JavaScript variable name for it. I named is as “jsTestA” and “jsTestB”. The variable name is case-sensitive.
//This is the jsTestA on Change event handler. //This function is triggered each time the radio button changes value NWF$("#" + jsTestA).change(function() {
//Here we retrieve the current value of jsTestA //The variable "varTestA" stores the value var varTestA = NWF$("#" + jsTestA + ' input:checked').val();
//Here we set the value for jsTestB if (varTestA == "Yes") { // jsTestB is YES when jsTestA is YES NWF$('#' + jsTestB).find('input:radio[value="Yes"]').prop("checked",true); } else { // jsTestB is NO when jsTestA is NO NWF$("#" + jsTestB).find('input:radio[value="No"]').prop("checked",true); } }); });
Clear code without the comments
NWF.FormFiller.Events.RegisterAfterReady(function() { NWF$("#" + jsTestA).change(function() { //Get Value var varTestA = NWF$("#" + jsTestA + ' input:checked').val(); //Set Value if (varTestA == "Yes") { NWF$('#' + jsTestB).find('input:radio[value="Yes"]').prop("checked",true); } else { NWF$("#" + jsTestB).find('input:radio[value="No"]').prop("checked",true); } }); });