cancel
Showing results for 
Search instead for 
Did you mean: 
nps9
Nintex Newbie

How can I set Choice control value when in Option button display format

Jump to solution

I am able to get the value of the selected option of a choice control using:

function getCh1Val() { alert(NWF$('#'+cidCh1 + ' input:checked').val()); }

But I can't seem to set the value of the choice control when it is in option button display format. If I change it to drop down list format I can get and set the value with no problem.

0 Kudos
Reply
7 Replies
Highlighted
Automation Master
Automation Master

Re: How can I set Choice control value when in Option button display format

Jump to solution

try following

NWF$('#' + cidCh1).find('input:radio[value="Yes"]').attr("checked","true");

‌  ‌ set choice value‌ set radio value‌ set choice option value

0 Kudos
Reply
nps9
Nintex Newbie

Re: How can I set Choice control value when in Option button display format

Jump to solution

Thank you for your response Marian, I really appreciate it!

When I tried it at first it didn't work. So I went back and set Render as buttons to No and it worked perfect.If I have to I can change them but I really don't want to. I have four forms with about 350 choice controls all being rendered as buttons. We picked them because the forms are being filled out on a tablet with a finger and they are the easiest for them to select. Do you know what it would be if they are rendered as buttons?

0 Kudos
Reply
Automation Master
Automation Master

Re: How can I set Choice control value when in Option button display format

Jump to solution

I'd recommend you test it on your own, it may differ on each mobile platform.

0 Kudos
Reply
nps9
Nintex Newbie

Re: How can I set Choice control value when in Option button display format

Jump to solution

OK, I did a clean test and removed the tablet from the picture completely.

I created a new list with a choice column and opened form designer. I added a button and put the one line of code you provided above. I opened the form and sure enough clicking the button set the proper button on the choice control exactly as you said. However, when I change render as buttons to yes and open the form again - it does not set the button. This test was does on-prem, on a desktop PC in an SP2013 environment using Nintex Forms version 2.10.

0 Kudos
Reply
Automation Master
Automation Master

Re: How can I set Choice control value when in Option button display format

Jump to solution

try following

NWF$('#' + cidCh1).find('input:radio[value="Yes"]').click();

View solution in original post

Reply
nps9
Nintex Newbie

Re: How can I set Choice control value when in Option button display format

Jump to solution

That did it. Thank you very much Marian. I really appreciate your assistance.

Reply
Gentille
Nintex Newbie

Re: How can I set Choice control value when in Option button display format

Jump to solution

Hi All

 

I am new to Nintex. Please would you mind letting me know where this piece of code should be added or how it should be added and the variables which i need to change to my own controls?

 

Thank you

0 Kudos
Reply