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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Error: form was not recognized as valid for form capturing.

(0) ShareShare
ReportReport
Posted on by 5

Hello everyone.

So i'm working on a form for a client and I've been provided some scripts that generate the form.

The form appears on the page nicely and everything appears to work but the submissions. 

My formSubmit event looks like this and it goes through...

MsCrmMkt.MsCrmFormLoader.on('formSubmit', (e) => {
	e.preventDefault();
	window.formSubmitResult = MsCrmMkt.MsCrmFormLoader.sendFormCaptureToCrm(el.querySelector('form'));
	formSuccess();
	console.log("MsCrmMkt.MsCrmFormLoader.on('formSubmit') called.");

	console.log('result: ', window.formSubmitResult);
});


 but window.formSubmitResult outputs:

"Error: form was not recognized as valid for form capturing.
    at FormCaptureSendingQueue.sendingCallback (https://mktdplp102cdn.azureedge.net/public/latest/js/form-loader.js?v=1.71.2017.0:4:290023)
    at https://mktdplp102cdn.azureedge.net/public/latest/js/form-loader.js?v=1.71.2017.0:4:36078
    at M (https://mktdplp102cdn.azureedge.net/public/latest/js/form-loader.js?v=1.71.2017.0:4:2680)
    at new t (https://mktdplp102cdn.azureedge.net/public/latest/js/form-loader.js?v=1.71.2017.0:4:5913)
    at FormCaptureSendingQueue.enqueue (https://mktdplp102cdn.azureedge.net/public/latest/js/form-loader.js?v=1.71.2017.0:4:36012)
    at Function.FormLoaderInternal.sendFormCaptureToCrm (https://mktdplp102cdn.azureedge.net/public/latest/js/form-loader.js?v=1.71.2017.0:4:38959)
    at http://ppe.wpup.lt/wp-content/themes/ppe/assets/js/app.js?ver=1.0.1:30396:58
    at Function.FormLoaderInternal.triggerCallbacks (https://mktdplp102cdn.azureedge.net/public/latest/js/form-loader.js?v=1.71.2017.0:4:37688)
    at Function.FormLoaderInternal.trigger (https://mktdplp102cdn.azureedge.net/public/latest/js/form-loader.js?v=1.71.2017.0:4:37805)
    at FormLoaderInternal.trigger (https://mktdplp102cdn.azureedge.net/public/latest/js/form-loader.js?v=1.71.2017.0:4:37434)"


I've tried adding and removing various attributes i've found in the documentation like data-no-submit="true" and data-ignore-prevent-default="true" but it doesn't seem to work.

According to client the visits are getting tracked but there are no submissions.

The form can be accessed here: http://ppe.wpup.lt/contact/ , you can fill it with method window.fillForm()

Anybody can help me with this one? 

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

    Hi,

    Please refer to the following section:

    Extend marketing forms using code (Dynamics 365 Marketing Developer Guide) | Microsoft Docs

     

    It shows that the formSubmit event will not be triggered for captured forms.

     pastedimage1625814694545v1.png

    If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.

    Best Regards,

    Nya

  • donnervetter Profile Picture
    5 on at

    Hey Nya, thank you for your answer. My problem is that however I try to submit it returns the same error.

    Even if I try submitting it from the console like that:

    MsCrmMkt.MsCrmFormLoader.sendFormCaptureToCrm(el.querySelector('form'));


    The outcome is always the same: "Error: form was not recognized as valid for form capturing.". 

    Is there a way to know what makes the form unrecognisable for capturing?

  • thecharwest Profile Picture
    221 on at

    I'm having a similar issue with the same error - I don't suppose you've found a solution have you? :)

  • AriaConsulting Profile Picture
    2 on at

    I think possibly you missed the key point from what Nya replied: you can't use "formSubmit".  You CAN use "afterFormSubmit".

  • Suggested answer
    nickmcelligott Profile Picture
    5 on at

    It's looking for a `data-form-page-id` attribute on the `form` element, not sure why, but its not there. So you can manually add it before it submits;


    <script type="text/javascript">
    let formPageId;

    MsCrmMkt.MsCrmFormLoader.on("formLoad", function(e) {
        formPageId = e.getFormPageId();
    });

    document.querySelector('#button').addEventListener('click', function() {
        const form = document.querySelector('form');
        form.setAttribute("data-form-page-id", formPageId);
        MsCrmMkt.MsCrmFormLoader.sendFormCaptureToCrm(form).then(function() {
            console.log('submitted');
        }, function(err) {
            console.log(err);
        });
    });
    </script>

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans