Form "Not You?" functionality | Community
Skip to main content
November 14, 2013
Solved

Form "Not You?" functionality

  • November 14, 2013
  • 20 replies
  • 5623 views
Do any of you use "Not You?" buttons on forms (along side the Submit button)?

If so, how do you do this functionality?
Thanks!
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 Rafael_Santoni1
This is how we implemented it.

We have a link in all our Marketo pages that asks the visitor to "click here" if the information on the form is not theirs to re-set the information. Once the person clicks on that, a javascript function we created clears the cookie and re-loads the page.

In addition to that, we check for a URL parameter (userID=guest). If any of our pages are called with that URL parameter present, we also clear the Marketo prefill and all the fields prior to rendering the page. We do that with a short JavaScript function. This allows us to link to any of our Marketo lead capture pages forcing not pre-filling the forms even for known leads if we wanted to.

Summary:
  1. Create a function that would clear the values, cookie, etc.
  2. Place link on your template to call the function to clear and reload the page.
Simple, non-intrusive, and easy to deploy and maintain.

If you wanted to apply the same functionality to the reset button on the form, you can use jQuery to "listen" to a click on the button and fire the same function or have it call the same page with the "magic" URL parameter.

Good luck!

Rafael

20 replies

Rafael_Santoni1
Level 5
March 10, 2014
Scratch my last comment, I just realized that you were working on 2.0 forms. Good to know. The other thing that could be done is to reset any form regardless of which class they are using. Since in most cases, there would be only one form, that should take care of both cases.

i.e.
$jQ("form")...
March 11, 2014
This is awesome! We are having issues in this area and this is likely one good way to help alleviate our problems too. Thanks!!
April 2, 2014
[deleted]
July 11, 2014
Hopefully someone is still subscribed to this thread...

If we wanted to make the clear happen via clicking on some text like "Not You? Click here..." how would we make that happen?

As far as I can tell the javascript above is only for the "Clear" button that shows below the forms.

My unsubscribe form has a bunch of text breaks and things, so having the clear button be all the way at the bottom doesn't serve my needs. I want to have text next to the email field that allows them to clear it there.

Thanks!
Rafael_Santoni1
Level 5
July 11, 2014
The code I sampled here can be used in a regular text link, the submit button or even by loading the page with url parameters. If you have access to a JavaScript developer, it should be clear how to implement it. On my pages, I leverage it whenver the page is loaded with the url parameter userId=guest, so I simply use a relative text link on the page that links to the same page itself, including the url parameter.

i.e. If the form pre-populated below is not you, 
   < a id="mktoGuest" href="?userId=guest">click here</a >

But you could also invoke it by calling the function from a regular text link.

The reset button does not necessarily clear the cookie values, just the field values but the person might still be recognized, so I ensure to remove all traces by doing both things at the same time.

I hope that helps clarify it.

Rafael
November 12, 2014
Thank you, Rafael, for the information and code! I'll be starting implementation and testing of this very soon on my company's Marketo registration pages.

Hopefully this will be a built-in feature in a future release of the forms.

Allison
November 13, 2014
Here is the jQuery that we will be implementing on our forms. It has been tested on Forms 2.0 and it resets the fields if the "Not You" link is clicked or if the URL has "user=guest" as a parameter.

Note: I did change the previous "userID" to "user" to shorten it.

jQuery(document).ready(function($){

    function resetMktoForm() {
        $("#_mkt_trk").val('');
        mktoPreFillFields = {};
        $(".mktoForm")[0].reset();
        document.cookie = '_mkto_trk=NULL; expires=-1; path=/; domain=.planview.com';
    }
    
    if(window.location.search.indexOf("user=guest") > -1){
        resetMktoForm();
    }
    
    // If Clear is clicked remove Marketo cookies, prefill, etc.
    $('html').on('click', '.mktFrmReset', function (event) {
        event.preventDefault();
        resetMktoForm();
    });

});

Also, here is our "Not You" link code we have inserted as Rich Text in our form:

<a href="#" class="mktFrmReset">Not You? Reset this form</a>

We're still working on getting this to work with Progressive Profiling. Currently if Progressive Profiling is enabled and the "Not You" link is clicked, it does not completely refresh the form to show the Progressive Profiling fields that are not visible. It only resets the visible fields.

My developer is working to make this work with Progressive Profiling, but I wanted to share what we have now. Enjoy!

Allison
December 3, 2014
Thanks for the code it was very usefull but as mentioned above Marketo should integrate this as an option in the form builder. 

- one option should be to create a link above the form (f.e. Not you? Click to clear form)
- second option should be a button a the bottom of the form (F.e Clear Form)

Both options should be available the first one if the form is pre-populated with details of someone else
Second option I would use in case when it is a longer form and the user just wants to clear it at the end. 
August 6, 2015

Unfortunately this doesn't seem to work for me with Marketo's new guided templates!

Has anyone got this working or have an alternative with the guided templates?

Rafael_Santoni1
Level 5
August 6, 2015

Matthew,

I am sure it is possible even with those templates because the solution is not dependent on the template used. The Marketo cookie is "_mkto_trk" no matter what template you use and the prefilled values leverage the mktoPreFillFields array always. As long as you can destroy the cookie, it should work and clear the prefill values, you should be ok. Try putting the code below on one of your pages and visit the URL appending "?userId=guest" right after the page address. Make sure to replace the part that says "insert_your_domain_here" with your Marketo page URL domain name.

<script>

$jQuery(document).ready(function(){

if(Mkto.getUrlParam("userId") == "guest"){

         $jQuery("#_mkt_trk").val('');

         mktoPreFillFields = {};

         $jQuery(".lpeRegForm")[0].reset();

         document.cookie = '_mkto_trk=NULL; expires=-1; path=/; domain=.insert_your_domain_here.com';

     }  

});

</script>

By the way, there might be some tweaks needed for this code to work depending on the form you are using on the page.

If you have any problems implementing it, feel free to drop me a line at rafael.santoni@citrix.com

Good luck!

Rafael

SanfordWhiteman
Level 10
August 6, 2015

Rafael, really shouldn't use NULL here because misleadingly implies it has a special value, but it's just a literal four-letter string "NULL" in the cookie context.  For example, if I do document.cookie='abc123=NULL ... ' I'll then have a cookie named abc123 with value "NULL".  Instead, when deleting a cookie, use an empty value to signify your intent to delete it: document.cookie='_mkto_trk=; ... ';

Also, Forms 2.0 doesn't have the #_mkt_trk field, so you don't need to clear its value, though I suppose it's harmless to use it.

Perhaps more important than the above, your code has a race condition if you try to use it with embedded forms (including when the external embed code is used on Marketo-hosted LPs).  It'll sometimes work and sometimes not.  You should use the Marketo Forms 2.0 API (the whenReady event) to ensure that the form actually exists in the DOM at the point you try to reset it.  Don't try to guess when the form is in the page, let the form itself tell you when it is ready to be filled/reset/modified.

Courtney_McAra4
Level 4
August 6, 2015

Small plug for LaunchPoint Partner Marketera who can help with things like this - aka a Resource Center

Marketing Design: Web, Email, Social, & Print – Marketo LaunchPoint