Add onSubmit to FORM-tag


For linking the landing page to our CRM, I have added some javascript code. Now I need to run this code on form submit.

So in the FORM-tag, I need to remove the ACTION and replace it with: onSubmit=“createObject(); return false”

Is it possible to edit the HTML-code?
Can you please advice?

Thank you


Hi @VincentTahon,

You will need to write a bit of JS to accomplish what you want.

You’ll have to pause the form submit action, execute your createObject and release the native form action to complete the form submission.

Hope this points you in the right direction.



Hi Hristian,

Thank you for the advice.
I have tried, but did not succeed in pausing the form-submit action. Do you have an example for that?

These are some things I tried (but unfortunately I am not very skilled in JS):

jQuery(document).ready(function() {
(document).find("form").eq(0).removeAttr("method"); (document).find(“form”).eq(0).removeAttr(“action”);
(document).find("form").eq(0).attr("id","myform123"); (document).find(“form”).eq(0).attr(“onSubmit”,“createObject(); return false”);
// alert(“Page loaded”);

After submit I see: “Uncaught TypeError: Cannot read property ‘nodeType’ of null"

Instead of adding the onSubmit attribute, I also tried this:

$(document).on(“submit”, “#myform123”, function(e) {
// alert("submitted myform123”);

But again, same error occurs…

Kind regards,