Share via

JavaScript error when submitting signup form after unchecking pre-selected checkbox

Saravana Kumar Palanisamy 30 Reputation points
2026-01-17T04:03:06.4366667+00:00

I have an optional checkbox in my signup form.

Initially, I pre-selected this checkbox by passing true to the extension attribute during the OnAttributeCollectionStart event. With this setup, the checkbox appears selected by default.

However, when the user unchecks the checkbox and submits the form, a JavaScript error appears in the browser console.

I also tried removing the attribute assignment from the OnAttributeCollectionStart event. In this case:

  • The checkbox is not selected by default

Submitting the form without interacting with the checkbox works fine

But if I check the checkbox, then uncheck it, and submit the form, I get the same JavaScript error

So in summary:

Pre-selected checkbox → uncheck → submit → ❌ JavaScript error

Not pre-selected → check → uncheck → submit → ❌ JavaScript error

Not pre-selected → never touched → submit → ✅ works

Has anyone encountered this behavior before? Any idea why toggling the checkbox state (especially from checked to unchecked) causes a JavaScript error on submit?I have an optional checkbox in my signup form.

Initially, I pre-selected this checkbox by passing true to the extension attribute during the OnAttributeCollectionStart event. With this setup, the checkbox appears selected by default.

However, when the user unchecks the checkbox and submits the form, a JavaScript error appears in the browser console.

I also tried removing the attribute assignment from the OnAttributeCollectionStart event. In this case:

The checkbox is not selected by default

Submitting the form without interacting with the checkbox works fine

But if I check the checkbox, then uncheck it, and submit the form, I get the same JavaScript error

So in summary:

Pre-selected checkbox → uncheck → submit → ❌ JavaScript error

Not pre-selected → check → uncheck → submit → ❌ JavaScript error

Not pre-selected → never touched → submit → ✅ works

Has anyone encountered this behavior before?
Any idea why toggling the checkbox state (especially from checked to unchecked) causes a JavaScript error on submit?

User's image

User's image

User's image

Microsoft Security | Microsoft Entra | Microsoft Entra External ID
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.