SOLVED

Using multiple form conditions to determine thank you page - GDPR

Go to solution
SanfordWhiteman
Level 10 - Community Moderator

Re: Using multiple form conditions to determine thank you page - GDPR

You place the custom forms JS in a <script> block directly after the standard embed code.

Anonymous
Not applicable

Re: Using multiple form conditions to determine thank you page - GDPR

That's what I did initially but my simple test did not work.

I find that after filling out the embedded form the formredirect field remains NULL (although it updates correctly when on a marketo landing page). Am I missing something? Here's what I've embedded

<script src="//app-sj20.marketo.com/js/forms2/js/forms2.min.js">

</script>

<form id="mktoForm_1232"></form>

<script>MktoForms2.loadForm("//app-sj20.marketo.com", "530-RLQ-870", 1232);</script>

<script>

MktoForms2.whenReady(function(form){

form.onSubmit(function(form){

   form.addHiddenFields({ formredirect : a_different_value)});

});

});

</script>

Anonymous
Not applicable

Re: Using multiple form conditions to determine thank you page - GDPR

For the record this is up and running now small issue on the word press side of things.  Thanks Sanford.

Michael_McGowan
Level 1

Re: Using multiple form conditions to determine thank you page - GDPR

Hi Sanford,

I am trying to use this script but find that it is not consolidating the values and inserting them into the hidden field. The hidden field (mkto_AscentTest_4) is in the form and has string as its data value. Here is the code that I am using.

MktoForms2.whenReady(function(form){

form.onSubmit(function(form){

var currentValues = form.getValues(),

fieldsToConsolidate = ["mkto_AscentTest_1","mkto_AscentTest_2","mkto_AscentTest_3"],

mkto_AscentTest_4 =

fieldsToConsolidate

.map(function(field){

return currentValues[field];

})

.join(";");

form.addHiddenFields({ mkto_AscentTest_4 : mkto_AscentTest_4 });

});

});

Any thoughts?

SanfordWhiteman
Level 10 - Community Moderator

Re: Using multiple form conditions to determine thank you page - GDPR

Please provide your URL. The code on its own is fine.

Michael_McGowa1
Level 3

Re: Using multiple form conditions to determine thank you page - GDPR

Here is the link to the page​.

SanfordWhiteman
Level 10 - Community Moderator

Re: Using multiple form conditions to determine thank you page - GDPR

You're using the wrong field names. The prefix "mkto_" doesn't exist on those fields, and they don't have underscores.

pastedImage_0.png

Michael_McGowa1
Level 3

Re: Using multiple form conditions to determine thank you page - GDPR

Thank you Sanford, that worked. However, I am confused on about this. In my instance the field names do have mkto_ in them. Below is a screenshot of the fields in the database.

pastedImage_0.png

And when I go to edit the form, the field names are consistent.

pastedImage_1.png

Is it because I am embedding the code on my site that the names change? Maybe beyond the scope of this thread but curious. As always, thanks for the help.

SanfordWhiteman
Level 10 - Community Moderator

Re: Using multiple form conditions to determine thank you page - GDPR

The form fields will be the SOAP field names (as opposed to the friendly names). So export all your fields from Field Management, check the SOAP column, and you'll always be accurate.