{{form.NotYou}} link actions | Community
Skip to main content
Community Manager
August 2, 2017
Solved

{{form.NotYou}} link actions

  • August 2, 2017
  • 1 reply
  • 2604 views

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?

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 SanfordWhiteman

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();

    });

   

  }

});

1 reply

Josh_Hill13
New Participant
August 3, 2017

would you send a sample or URL?

JDNelson1Author
Community Manager
August 3, 2017

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/

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
August 3, 2017

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();

    });

   

  }

});