Hi,
I got a checkbox (subscription list) regarding conditions of participation (id of the checkbox field = c9f733b0-fd5b-ec11-8f8f-000d3adf1c7e ) on my marketing form.
What I want to achieve is, if the checkbox is NOT checked the form can not be submitted and the default "required field" error message should pop up.
I found this validation sample for dynamics marketing:
MsCrmMkt.MsCrmFormLoader.on('formSubmit', function(event)
{ // sample validation - check if
document.getElementById('txt-company-name-message').style.visibility = 'hidden';
var companyName = document.getElementById('txt-company-name').value;
if (companyName !== 'Fabricam' && companyName != 'Contoso')
{ document.getElementById('txt-company-name-message').style.visibility = 'visible';
event.preventDefault();
} });
How would I need modify this javascript to reach the behaviour with "If checkbox (c9f733b0-fd5b-ec11-8f8f-000d3adf1c7e) is not checked or =! 1, dont submit the form and throw and error.
Thanks!
Hi,
The code can be something like the following:
var isChecked = document.getElementById('c9f733b0-fd5b-ec11-8f8f-000d3adf1c7e').value; if (isChecked == false) { document.getElementById("isChecked").checked = true; }
André Arnaud de Cal...
291,969
Super User 2025 Season 1
Martin Dráb
230,842
Most Valuable Professional
nmaenpaa
101,156