What is the code to disable prefill/pre-pop for a single form field? | Community
Skip to main content
February 5, 2013
Solved

What is the code to disable prefill/pre-pop for a single form field?

  • February 5, 2013
  • 5 replies
  • 1849 views
I've worked on projects where there was some javascript that went in the Head section that allowed you to specify a single field on a form that would NOT pre-pop. We found it very useful when people were registering for webinars and wanted to change the date of the registration or register for multiple dates. Now that I'm at a new gig, I can't find this code anywhere in the Community. Help?
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 Jep_Castelein2

It's the last code sample on this page: https://community.marketo.com/MarketoArticle?id=kA050000000Kyy3

Best, 
Jep

Replace the yellow text with your exact field name

<script type="text/javascript" src="/js/public/jquery-latest.min.js"></script>
<script type="text/javascript">
    // set no conflict mode for jquery
  var $jQ = jQuery.noConflict();

  $jQ(document).ready(function(){
    $jQ('#Comments').attr('value','');
  });
</script>

5 replies

February 5, 2013
We at Bazaarvoice have also been struggling with this. Marketo - please help!
Jep_Castelein2
Jep_Castelein2Accepted solution
Level 10
February 6, 2013

It's the last code sample on this page: https://community.marketo.com/MarketoArticle?id=kA050000000Kyy3

Best, 
Jep

Replace the yellow text with your exact field name

<script type="text/javascript" src="/js/public/jquery-latest.min.js"></script>
<script type="text/javascript">
    // set no conflict mode for jquery
  var $jQ = jQuery.noConflict();

  $jQ(document).ready(function(){
    $jQ('#Comments').attr('value','');
  });
</script>

February 6, 2013
Thanks, Jep. That's the code I've been using. The problem is with leads who already have data in this field. For them, the old values for this field are still showing up in the drop down as an option. The value is saved in the lead record, but has been deleted as an option on the form. See below.


Here is the page URL where we're having the problem: http://resources.bazaarvoice.com/Connections.webinar.choice.html.
Jep_Castelein2
Level 10
February 6, 2013
@ Matt: yeah, that's how pre-filling for dropdowns works. You can modify the JavaScript from my link above to remove the last "option" from the "select" (pre-filling inserts the option at the end). I'm not a JavaScript developer, so can't help you writing the code unfortunately
October 19, 2013
Any resolution to this? We also have this drop down field issue.