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());
});
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());
});
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());
});
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.
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());
});
Thank you so much Chad Davis. It worked.
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!
Can you include some print screens of what you're trying to accomplish? I'm more of a visual learner.
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.