AnsweredAssumed Answered

Javascript to check a checkbox on a button click

Question asked by mindymac03 on Mar 13, 2018
Latest reply on Mar 14, 2018 by jpmhuls

I am trying to programmatically change the value of a Yes/No column from its default of No to Yes when the user clicks a button. I am missing one piece and I'm not sure what. Appreciate any advice.

 

Checkbox - name is ApprovalbyDonor.

In Advanced properties | Client ID JavaScript variable name, I have jsApprovalbyDonor

 

Save button - In Advanced | Client click, I have ClickMe()

 

The form's Settings | Custom Javascript, I have
function ClickMe() {
   NWF$('#' + jsApprovalbyDonor).attr('checked',true);
   alert('hi');
}

 

The javascript is called when I click the save button. The 'hi' alert box does appear (at which time I can see my checkbox on the form has been checked as well). But the underlying list value associated with the checkbox - ApprovalbyDonor does not change from No to Yes on that Save click.

 

(Right now I have the checkbox visible but once I get this working, its visibility property will be set to false... this is why I'm not having the user just manually check the box).

Outcomes