Using Javascript to Auto-Submit a form | Community
Skip to main content
Neil_Robertson6
Level 4
July 17, 2014
Question

Using Javascript to Auto-Submit a form

  • July 17, 2014
  • 2 replies
  • 7274 views
Hi All,

Has anyone successfully managed to utilise Javascript to auto-submit a Marketo form?    I have manage to successfully address a form in the system using a simple document.forms['mktoForm_XXXX'].submit(); however the form itself never submits/redirect?

Thanks

N

2 replies

Rafael_Santoni1
Level 5
July 17, 2014
Yes. It is possible. I developed a solution here at Citrix that auto-submits a hidden form if the user is a return/cookied user.

I used jQuery using:
Mkto.formSubmit($jQ('#mktFrmSubmit').parents('form:first').get(0));

I do a lot more than just submit the form but that's the one-liner I am using to submit it.

The other thing to keep in mind is that I did this using the Forms 1.0 editor not 2.0, but my guess is that it should be possible with 2.0 as well perhaps with a minor change.

Good luck!

Rafael
November 28, 2015

Rafael:

Can you tell me where to insert the js in the for so it can be auto submitted?

Mkto.formSubmit($jQ('#mktFrmSubmit').parents('form:first').get(0));

Thank You

Jerry Cooper

thetrustadvisor@gmail.com

(310) 745-9942

SanfordWhiteman
Level 10
November 28, 2015

Not sure about the Marked as Helpful, man... anyway, are you really using a Forms 1.0 form?

Kenny_Elkington
Adobe Employee
Adobe Employee
July 17, 2014
Hey Neil,

If you're using Forms 2.0, there's a full API available for form manipulation which you can find here: http://developers.marketo.com/documentation/websites/forms-2-0/  The .submit() method provided to automatically initialize the submission process, as well as the .getValues() method if you want to pull a JS object to submit via your own Ajax methods.