AnsweredAssumed Answered

JavaScript to "select all" and "clear all" for only one field.

Question asked by bakerls on Sep 7, 2018
Latest reply on Sep 11, 2018 by bakerls

Hi,

 

I've added the "Select all" and "Clear all" buttons in order to have that functionality on a Multiselect multi choice field.

 

The code I have for both is:

 

Clear all

NWF$('input:checkbox').not(this).prop('checked', this.checked);


Select all

NWF$('input:checkbox').not(this).prop('checked', true);

 

Which is working fine. However If I add another field like that it affects all multichoice fields... How can I change this code in order to affect only one particular multichoice field?

 

Checking on the source code of this form I got this data from this particular Multichoice field:

 

<div data-UniqueId="c0a89c70-0781-4bd4-8623-f73675005e02" data-ControlName="Activity" class=" nf-filler-control nf-filler-highlightonvalidationerror  nf-resizable nf-resizable" FormControlId="e1d46371-c4a5-4f09-a77a-c0128ce1f206" data-multiselectcontrol="True" style="overflow:visible;height:85px;width:830px;top:705px;left:0px;z-index:100;background-color:;" data-controlid="e1d46371-c4a5-4f09-a77a-c0128ce1f206" data-formcontroltypeid="c0a89c70-0781-4bd4-8623-f73675005e02" data-enabled="True">

 

Thanks!

Outcomes