Re: Checking whether form Prefill Change will affect my hidden capture on Forms

Jim_McLemore
Level 2

Checking whether form Prefill Change will affect my hidden capture on Forms

Here is the page with the hidden forms:

https://yello.co/resource/guide/be-a-champion-for-diversity-today-toolkit/thank-you/

You can only really get to this by filling out the form on:

https://yello.co/resource/guide/be-a-champion-for-diversity-today-toolkit

Some people may navigate around and come back here though.

Sanford Whiteman

Thank you!

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Checking whether form Prefill Change will affect my hidden capture on Forms

That code is fine; it doesn't depend on native Pre-Fill. They aren't really hidden forms, just forms with a button only!

However, you should take out the jQuery ready wrapper. It serves no purpose, as it's impossible to get to that line and not have MktoForms2 in scope. (jQuery can't be used to time Marketo form events in any case.)

Also a little concerned about the amount of repetition in that if/else if block. But that's on you to refactor.

SanfordWhiteman
Level 10 - Community Moderator

Re: Checking whether form Prefill Change will affect my hidden capture on Forms

But that's on you to refactor.

Couldn't stop myself, please do it more like this to follow the DRY principle:

form.onSuccess(function(vals, followUpUrl) {

var formId = form.getId(),

thankYouByFormId = {

"1740": "https://yello.co/wp-content/uploads/2018/10/TL_2018_Diversity_Study.pdf",

"1741": "https://yello.co/resource/webinar/be-a-champion-for-diversity/thank-you",

"1743": "https://yello.co/blog/5-important-diversity-conference-metrics",

"1744": "https://yello.co/blog/how-to-start-and-sustain-conversations-with-diverse-candidates",

"1745": "https://yello.co/blog/recruiting-strategies-to-tap-unique-backgrounds",

"1742": "https://yello.co/wp-content/uploads/2019/01/yello_product_stack_Diversity-1.pdf",

"1746": "https://yello.co/wp-content/uploads/2019/01/Diversity_InfographicV4_Final.pdf",

"1748": "https://yello.co/blog/four-ways-to-recruit-for-the-surprising-diversity-factor-you-havent-been-thinking-about",

"1749": "https://yello.co/wp-content/uploads/2019/01/PrepareforYourNextDiversityConference.pdf"

},

matchedThankYou = thankYouByFormId[formId];

if (matchedThankYou !== undefined) {

thankYouWindow.document.location.href = matchedThankYou;

return false;

}

});