SOLVED

Re: Form "Not You?" functionality

Go to solution
Rafael_Santoni1
Level 5

Re: Form "Not You?" functionality

Hey Adam, I am curious about one thing. That would not work in my case because my forms never make use of that class. Mine consistently use lpeRegForm instead. Are you using the original form editor or version 2?
Rafael_Santoni1
Level 5

Re: Form "Not You?" functionality

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")...
Anonymous
Not applicable

Re: Form "Not You?" functionality

This is awesome! We are having issues in this area and this is likely one good way to help alleviate our problems too. Thanks!!
Anonymous
Not applicable

Re: Form "Not You?" functionality

[deleted]
Anonymous
Not applicable

Re: Form "Not You?" functionality

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

Re: Form "Not You?" functionality

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
Anonymous
Not applicable

Re: Form "Not You?" functionality

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
Anonymous
Not applicable

Re: Form "Not You?" functionality

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
Anonymous
Not applicable

Re: Form "Not You?" functionality

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. 
Anonymous
Not applicable

Re: Form "Not You?" functionality

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?