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

Multiple Choice Checkbox Value "alert"

Jump to solution

Why am I not getting the values of multiple selected check boxes with this code? what would rather work? Open to all suggestions. Thank you!

NWF$('#' + varMultiChoice).click(function(){
alert(NWF$('#' + varMultiChoice).val());
});‍‍‍
0 Kudos
Reply
7 Replies
chaddavis
Nintex Newbie

Re: Multiple Choice Checkbox Value "alert"

Jump to solution

It's because the values aren't actually in the varMultiChoice field. It's a table. The values you're looking for are in the input fields inside the table.

Try this:

NWF$('#' + varMultiChoice + ' input').click(function(){
    alert(NWF$(this).val());
});
0 Kudos
Reply
Highlighted
ahmad84
Nintex Newbie

Re: Multiple Choice Checkbox Value "alert"

Jump to solution

I am not getting the value though. It just says "on" and I know it is because that's how it has been default coded.

what I am trying to do is to get the value (name) of the selected checkbox. In this case it should be "High Pressure".

This is why I am getting value "on". Is there any way to get data-nfChoiceValue?

MultiChoice

This is what I am getting.

alert

0 Kudos
Reply
chaddavis
Nintex Newbie

Re: Multiple Choice Checkbox Value "alert"

Jump to solution

When I tested a Choice field with checkboxes, it set the text as the value of the input field as well as being the text of the label:

I suppose you could try something like this, where it grabs the text of the label that is immediately after the input field:

NWF$('#' + varMultiChoice + ' input').click(function(){
     alert(NWF$(this).next("label").text());
});
Reply
ahmad84
Nintex Newbie

Re: Multiple Choice Checkbox Value "alert"

Jump to solution

Thank you so much Chad Davis. It worked.  

Reply
ahmad84
Nintex Newbie

Re: Multiple Choice Checkbox Value "alert"

Jump to solution

Thank you Chad Davis, it was a very big help but I am still kind of stuck because I am not able to mark the value as selected which was the main purpose of this alert. I was testing it. Any idea how can I select one specific option with JS. I really appreciate your help. 

What I am try to do Rule 1

If user clicks "Not Applicable" all other options should go hide.

If user clicks any other option "Option 1" or "Option 2" then "Not Applicable" should go hide and I want to keep them all in one control.

Rule 2

If user change a lookup field in my form all other controls: textbox and dropdown are getting values automatically (because they are text fields) based on item selected from sharepoint list but this control (MultiChoice) is just getting the value but it is not populating i.e. It is not marking it as selected option which I may need to do with code manually like - if else. For this reason I am trying to understand how can I mark the option as selected, even by referring to label doesn't matter. Please feel free to share your thoughts. Thank you!

0 Kudos
Reply
chaddavis
Nintex Newbie

Re: Multiple Choice Checkbox Value "alert"

Jump to solution

Can you include some print screens of what you're trying to accomplish? I'm more of a visual learner.

0 Kudos
Reply
ahmad84
Nintex Newbie

Re: Multiple Choice Checkbox Value "alert"

Jump to solution

Here let me take you to the right direction. I have this question but so far I don't have any reply. In this post we are not discussing Rule 1. It is all about Rule 2 what I explain here.

  

0 Kudos
Reply