I have a Nintex form with two choice controls  (radio buttons) and three YesNo controls. I need to set the selection of the first choice control based on the values selected for the three YesNo controls and the second choice control. From what I've r

  • 29 August 2016
  • 5 replies
  • 5 views

Badge +1

I have a Nintex form with two choice controls  (radio buttons) and three YesNo controls. I need to set the selection of the first choice control based on the values selected for the three YesNo controls and the second choice control. From what I've read, this is not possible in Nintex via a rule, but only via custom Javascript. So I added a button to my form which, when clicked, is set up to run the following Javascript:

function TabsFunction() {

             var myVar = NWF${'#' + ChoiceCtl1).val();

             if ((NWF$('#' + CheckBox1).prop('checked') || NWF$('#' + CheckBox2).prop('checked') || NWF$('#' + CheckBox3).prop('checked')) && myVar == null )

             {

                         NWF$('#' + ChoiceCtl2).val('RCFA Investigation');

             }

             if ((myVar != null )

{

             NWF$('#' + ChoiceCtl2).val('SQESH Investigation');

}

}

I added this ClientClick to the button:

NWF$(document).ready(function(){TabsFunction();});

When I try to test my form with this, all I get is "Please wait".

I am familiar with Javascript but I don't really know 1) what the proper syntax is for Nintex, 2) what is the proper way to check if a choice control selection has been made or not, or 3) if this can even be done in Nintex. I have searched extensively but still haven't found a workable method.

Any help or guidance to resources will be greatly appreciated!


5 replies

Badge +10

Hi Jayne,

you can use the below to get the value of the option button

var opt1 = NWF$('#' + option1 + ' :checked').val();

Try using alert if the value reading is correct or not

Badge +1

Sojan, thank you for your reply!

I tried this:

function TabsFunction() {

var opt1 = NWF$('#' + option1 + ' :checked').val();

alert(opt1);

}

and nothing was displayed.

I also tried this:

function TabsFunction() {

var opt1 = NWF$('#' + option1 + ' :checked').val();

alert('Hello');

}

and still nothing was displayed.

But when I tried this:

function TabsFunction() {

alert('Hello');

}

it displays the text.

Is my syntax incorrect?

Thank you,
Jayne

Badge +10

Hi Jayne,

the script is giving error on that line,

Is the variable is option1 is Client ID JavaScript variable?

Badge +1

I finally realized that for what I need to do the javascript was kind of overkill. I resolved this by using rules instead.

I need assistance with another custom javascript which I'll ask in a new questions.

Thanks to all who replied.

Userlevel 5
Badge +13

Sojan thank you thank you thank you! This finally worked for me after trying other iterations of .val and .text as well as ' : option:selected' and checked and all KINDS of different methods!

Reply