SOLVED

{{form.NotYou}} link actions

Go to solution
Highlighted
Champion Moderator

{{form.NotYou}} link actions

I'm having an issue where, when you click 'not you' it refreshes the page .... the form I am using is at the BOTTOM, so it's quite a bit of scrolling to back to where you were. Is there any way to control it, whether it's an anchor, or preventing the page from refreshing and just refreshing the form with a new cookie, or what are my options? Anyone have experience doing this?

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level 10 - Community Moderator

Re: {{form.NotYou}} link actions

Me-oh-my this is unpretty, and I feel dirty even touching jQuery, but it should work:

MktoForms2.whenReady(function(form){

  var jQuery = MktoForms2.$,

      formEl = form.getFormElem()[0],

      notYou = formEl.querySelector('.mktoNotYou');

  if (notYou) {

    var originalHandler = jQuery._data(notYou).events.click[0].handler;

    jQuery(notYou).off("click");

    notYou.addEventListener("click",function(e){

       document.location.hash = formEl.id;

       originalHandler();

    });

   

  }

});

View solution in original post

3 REPLIES 3
Highlighted
Level 10 - Champion Alumni

Re: {{form.NotYou}} link actions

would you send a sample or URL?

Highlighted
Champion Moderator

Re: {{form.NotYou}} link actions

Thanks Josh,

There's a form at the bottom of this page that we're re-doing; but want to build in the ability to 'not you' to the bottom at the same time.

https://www.spigit.com/spigit-for-ceo/

Highlighted
Level 10 - Community Moderator

Re: {{form.NotYou}} link actions

Me-oh-my this is unpretty, and I feel dirty even touching jQuery, but it should work:

MktoForms2.whenReady(function(form){

  var jQuery = MktoForms2.$,

      formEl = form.getFormElem()[0],

      notYou = formEl.querySelector('.mktoNotYou');

  if (notYou) {

    var originalHandler = jQuery._data(notYou).events.click[0].handler;

    jQuery(notYou).off("click");

    notYou.addEventListener("click",function(e){

       document.location.hash = formEl.id;

       originalHandler();

    });

   

  }

});

View solution in original post