Re: Displaying boolean values on a follow up page

Justin_Laberge1
Level 4

Displaying boolean values on a follow up page

Hey guys, in my quest to update our unsubscribe preference center, I wanted to see if you all had some ideas with showing people which newsletters they unsubscribed from on the thank you page.

Basically the set up is as standard as any other "preference center" with boolean fields being used as unsub/sub fields as lists are updated via programs.

I wanted to display which newsletters the user unsubscribed from on the Thank You page. When I add the values in the thank-you page it simply displays a "1" or a "0" as the output.

How would I be able to display the field if the value is turned to "true" ie: "you have unsubscribed from news, updates, events."?

Thank you for your time

2 REPLIES 2
Nicholas_Manojl
Level 9

Re: Displaying boolean values on a follow up page

You could put a different form on the follow-up page (and hide the submit button with CSS). This will allow you to use visibility rules on rich text sections.

I may not be following exactly what you're doing. I wouldn't go to a great deal of effort to service people who have unsubscribed from comms.

SanfordWhiteman
Level 10 - Community Moderator

Re: Displaying boolean values on a follow up page

You can pass the "yes" booleans (they're not actually Boolean true on the client side, long story) to the Thank You page like this:

MktoForms2.whenReady(function(form) {   

    form.onSuccess(function(vals, tyURL) {

        var yesValues = Object.keys(vals)

                     .filter(function(field){

                                     return vals[field] == "yes";

                                 })

                     .join(",");

       

        document.location.href = tyURL + '#' + yesValues;

        return false;

    });

});

Then print document.location.hash on the Thank You page.

Demo: https://codepen.io/figureone/debug/KXOopM