web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Dynamics Marketing form validation (javascript)

(0) ShareShare
ReportReport
Posted on by 2

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!

I have the same question (0)
  • Suggested answer
    Nya Profile Picture
    29,060 on at

    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;
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 213 Super User 2026 Season 1

#2
CU11031447-0 Profile Picture

CU11031447-0 100

#3
NeerajPawar Profile Picture

NeerajPawar 71

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans