Solved

Set value for Dropdown from another dropdown in Nintex Form

  • 6 January 2023
  • 6 replies
  • 128 views

Badge +1

Hi,

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!

icon

Best answer by Garrett 8 January 2023, 16:51

View original

6 replies

Userlevel 2
Badge +6

Hi,

 

You can do something like this:
 

Bu you have to hardcode a rule for all of your options

Userlevel 5
Badge +13

Hi @Var560121 

 

@Prineel_V3 has answered your question. I am just adding extra info.

If this is your Form with “Choice 1” and “Choice 2”, you can use a single rule to make Choice 2 follow the outcome of Choice 1. 

 

Badge +1

Hi @Garrett  @Prineel_V3 

My bad! I am using Nintex on-prem version 2019.

Is it the same solution for on-prem version also?

Userlevel 5
Badge +13

Hi @Var560121 

As you have posted this in the Automation Cloud forum, the New Responsive Designer is the only option.

 

Anyway, would you know which Form Designer which you are using?

Perhaps, you could share a screenshot of the Form?

 

Badge +1

@Garrett

I am using Nintex Forms in SP2019 with classic option.

 

 

Userlevel 5
Badge +13

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

 

Next, add the following JavaScript code.

Click Forms Setting in the Designer toolbar.

Expand the Custom JavaScript section

Add the following code

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

//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);
}
});
});

Output

 

Reply