How to clear out form field info on page load | Community
Skip to main content
Level 4
April 2, 2015
Solved

How to clear out form field info on page load

  • April 2, 2015
  • 6 replies
  • 3171 views


Hi I have created a landing page we are going to use at PyCon this year for people to create accounts for our product.  We are going to have this on a Ipad at our booth and pass it to people who are interested in signing up.  I was looking for a way to have no prefil text inside the form fields.  I disabled pre-fill inside the form editor and still there are forms that get preloaded with text of the last form submit.  I try using some javascript to clear out the forms but have had not luck.  The form is on a landing page that is being iframed and displayed on another landing page.  Has anyone else run into an issue similar to this and have a solution they would willing to share?  Thanks!

-John
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Justin_Cooperm2
By the way, make sure you disable pre-fill on every field in your form! I have a hunch that is what your issue could be.

6 replies

Josh_Hill13
Level 10
April 2, 2015
can you remove the munchkin code from both pages?

also disable prefill on the page
Justin_Cooperm2
Level 10
April 2, 2015
Sounds like you've already seen forms docs:
http://developers.marketo.com/documentation/websites/forms-2-0/

In the onSuccess callback add one line of JS:
location.reload(true);

If your form has pre-fill disabled, then refreshing the page should make it work the way you want.
Justin_Cooperm2
Justin_Cooperm2Accepted solution
Level 10
April 2, 2015
By the way, make sure you disable pre-fill on every field in your form! I have a hunch that is what your issue could be.
Level 4
April 2, 2015
Annnnd.....I am an idiot.  Did not turn off pre-fill on all the fields, works like a charm now.  Thanks guys
SanfordWhiteman
Level 10
April 2, 2015
@Justin C One last thing: I feel this should be in the onSuccess rather than the onSubmit to make sure it can't abort the async form post.
Justin_Cooperm2
Level 10
April 2, 2015
Sanford is correct, onSuccess() in the right way to do this.