Skip to main content

Hi all,

I'm trying to create a 'Select All' button that automatically checks every option for a specific choice (multiple) control on the form

I've been attempting this for a little while now but can not get this to work.  I found a number of posts that appears to have the exact information I needed, but upon implementing the custom JS, the checkbox values never change upon pressing the button.

One (the most recent) suggestion stated I should be using the following syntax: Re: Set value in choice column

NWF$("#"+myChoices).find(":checkboxxvalue='External']").attr("checked","checked");

An older post recommended using either of the following lines of code: Updating a checkbox in a checkbox group on a nintex form using NWF$

NWF$('document').ready(function(){

     NWF$('#'+jsvCheckboxField).find(':checkboxcvalue='Checkbox Choice 2']').attr('checked', 'checked');

     NWF$('#'+jsvCheckboxField).find('inputnvalue='Checkbox Choice 3']').attr('checked', 'checked');

});

Yet in every case when I try either method, the checkboxes do not update.  I placed an alert in the code to test if the function is actually being called (it is).  I just can not find how to get the checkboxes to update properly.  I have verified the javascript variable name for the choice control matches the custom JS (searchFields), and the function is set to run on client click of the 'Select All' button.

function selectAll() {

     NWF$("#" + searchFields).find(":checkbox.value='Subject Line']").attr("checked","checked");

     NWF$("#" + searchFields).find(":checkboxlvalue='Message Body']").attr("checked","checked");

     NWF$("#" + searchFields).find(":checkboxhvalue='Attachments']").attr("checked","checked");

     alert("test");

}

The alert comes up, but the 3 lines before do not appear to have accomplished anything.  It should be a very simple function really, so I'm convinced the issue is with the lines of code I'm using to update the checkboxes.

Capture.JPG

Does anyone have an idea as to what I could be missing here?

I appreciate any assistance with this frustrating issue.  Thanks!

On another post, someone else had mentioned that my code was working properly when they tried it.  I tried adding the elements t a blank form and testing again - the issue was still occurring.

If it makes a difference, we are running NF 2010 Version: 1.9.0.0.

Does anyone in a Forms 2010 environment have a similar function in their forms?   I would like to confirm if my code works in anyone else's environment, or if anyone has working code to accomplish what I need, that could be extremely useful as well.

In the meantime, I will start looking into some older postings since we aren't running the latest version.

Thanks in advance!


Hi jr204​,

The following versions of the selectAll function also worked for me, admittedly I'm using a later version.

function selectAll() {NWF$("#" + searchFields).find(":checkboxovalue='Subject Line']").attr("checked",true);NWF$("#" + searchFields).find(":checkboxovalue='Message Body']").attr("checked",true);NWF$("#" + searchFields).find(":checkboxovalue='Attachments']").attr("checked",true);alert("test");}

function selectAll() {NWF$("#" + searchFields).find(":checkboxovalue='Subject Line']").prop("checked",true);NWF$("#" + searchFields).find(":checkboxovalue='Message Body']").prop("checked",true);NWF$("#" + searchFields).find(":checkboxovalue='Attachments']").prop("checked",true);alert("test");}

Hope one of these works for you!

Jan


Hey jr204,

Not sure if you're still looking for this, but I was able to do it using the following jQuery:

RequiredChoicesList.find("input").prop("checked", true);


Hello jr204​ – Especially given that several others are having success with the same code you're trying... I would recommend manually retyping your JavaScript Client ID variables and/or recreating your controls to see if that's the issue.

I've run into problems at times simply because rich-text had found it's way into my variable/class names due to copy/paste.


Just an FYI, we have just recently upgraded both our SharePoint farm and our Nintex Forms to 2013.

I haven't had the time to revisit this form as we're still getting over some issues from the update.

I will be sure to update once I have some time to crack open that form again.  I suspect the issues were related to me running a (significantly) older version.


I suspect so, but let us know if you still have trouble following the upgrade!


Just an update, after upgrading to Forms 2013 the 'Select All' button I had previously tried implementing is now working properly without any additional action on my part.

Thanks again for all of your suggestions but it looks like this was most likely a bug in an older version of Forms.


jr204​ great to hear that fixed your issue!


Reply