Custom Module Update Via API - CheckBox is not updating

I’m loading a custom module update form (hidden) via a detail layout and checking/unchecking a form checkbox via Jquery code $(‘.class’)…prop( “checked”, false ); and $(‘.class’)…prop( “checked”, true); the checkbox is getting checked/unchecked but the field is NOT updated when submitted.

I’m using AJAX post to submit the form and get a successful item update response.

Hi @Lugene_Johnson

Does the checkbox submit as ‘checked’ ok, but just not when unchecked?
If so, the problem is likely due to the fact that by default, a checkbox does not submit anything to the server if it is not checked (so it can’t be submitted as unchecked).

This issue, and a possible solution, is discussed here:
BUG: Boolean Checkbox in Customer Submitted Item

Hope this can work for you.

If the checkbox value is not being submitted even when ‘checked’ there might be another issue.
In this case, could you post the form and JS code and/or a link to the page?

Hi Adam,

here’s the form field

I use an on/off switch to trigger the checked/unchecked for the checkbox, then AJAX post the form here’s the code:
function UpdateAMP(amp){

if (amp == ‘false’){
$(‘.AMP’).prop( “checked”, false );
$(‘.AMP’).prop( “checked”, true );

	var $f = $("#updateCollegeAMP_form");
	$.post($f.attr("action"), $f.serialize(), function(msg) {
	.fail(function(msg) { alert('Update FAIL') });
	return false; 

Thanks for posting the code.
To clarify, if you just hard-code the checkbox in your form and manually check it, does it submit the true value ok?

Yes, I’ve manually checked/unchecked the box and it updates correctly.

When the jquery code is triggered the checkbox is being unchecked/checked just fine but when submitted it’s not updating

Here’s the form field setup:


Solved the problem by using the onChange event vs onClick and directly clicking the form checkbox field
AMP Image

1 Like

Awesome. Glad you solved it.
And thanks for posting back here with the solution for others that may run into a similar issue.