Allow tokens to pre-populate hidden form fields in Forms 2.0 | Adobe Higher Education
Skip to main content
Dan_Stevens_
Level 10
November 5, 2014
Duplicate

Allow tokens to pre-populate hidden form fields in Forms 2.0

  • November 5, 2014
  • 5 respostas
  • 7704 Visualizações
Rather than create additional smart campaigns/flows to accomodate this, it would be really useful if system tokens (or even a local token) can be used as the default value for a form field - often times these are hidden fields.  For example, when someone opts-in to receive future email communications from us, we need to date-stamp an "optin date" field with the time/date that this took place.  To be able to use the {{system.dateTime}} token as the default value would be very convenient.

5 Respostas

Level 6
May 7, 2015
This would be nice. I am wanting to use a hidden field in our forms to determine product interest. The problem is that I don't want the new product interest to replace the old one; I want it appended to what is already there. The default value would look something like this:

{{lead.Product Interest}}; Interest X

This could potentially create a string of 2 or more product interests on a lead. I can add this in the Fills Out Form flow steps, but it would be nice to have it contained within the form.
Grégoire_Miche2
Level 10
January 23, 2016

That would make usage of global forms much more efficient. Issues such as setting a lead value based on the program values would be made very easy, even if it can also be set with change data values in a "fills our form" trigger campaign.

-Greg

SanfordWhiteman
Level 10
January 23, 2016

This is already possible by including tokens in the page that hosts the form.

mktoPreFillFields['my_field__c'] = "{{my.program_token}}";

Grégoire_Miche2
Level 10
January 23, 2016

Hi @Sanford Whiteman,

Do you mean simply in the HTML? or in a webready forms 2.0 callback? in a script?

And this would work only on a Marketo LP or also on any web page where the form is embedded?

Where is this documented? I have not been able to find this on developers.marketo.com.

Thanks,

-Greg

Grégoire_Miche2
Level 10
April 6, 2017

Hi all,

FYI, this in fact works. I created the following LP to test and demo it:

Token in hidden field demo

The setup is:

form:

field:

If you want that the token value always get to the hidden field, just make sure that the form prefill on the hidden field is disabled. If you only want the token to enter the field if it's empty, leave prefill enabled.

-Greg

April 6, 2017

Thanks, @Grégoire Michel​!

Would much rather accomplish it this way and know once upon a time this didn't work.

Appreciate you doing the legwork to proof that out - I've now removed the extra javascript from our page and went with this cleaner implementation.

Cheers,

John

Grégoire_Miche2
Level 10
April 6, 2017

You are welcome

February 7, 2020
No text available
Kenny_Elkington
Adobe Employee
Adobe Employee
August 17, 2021

There are several options to do this on Marketo Landing Pages including Greg's great example here.  We have no plans to make this a feature available via form embed code.  You can set default values either static or dynamic with the Forms JS API  See the "Set Values on Hidden Fields on the Form" Example