Can you update the label of a field in a Marketo form via the script at the page load? | Community
Skip to main content
New Participant
August 17, 2021
Solved

Can you update the label of a field in a Marketo form via the script at the page load?

  • August 17, 2021
  • 1 reply
  • 4196 views

Hi all,

I have created two custom fields named,

  • Custom Info Field_Str 
  • Custom Info Field_Text

The idea is to add these two fields into a Marketo form for specific events where we need to ask a specific question i.e. Dietary Requirement, Additional Comments, Travel Arrangements etc. Rather than creating a new field everytime or a new form everytime, I want to use these two fields in a form.

But is there a way I can modify the field label at the form load, so that the using the same form and same fields, I can ask different questions at different event pages?

Best answer by SanfordWhiteman

Hi @sanfordwhiteman ,

If I go with the campaign member fields, still how to I change the label of that "Event-Specific Question 1" dynamically at the form load, rather than creating a new form everytime? This is the main part of my question. 

Also on a different question, does PMCF appear when building forms as a field? 

I tried to create a "Campaign Member Field"called "Dietary Requirements" but it doesn't appear (not available in the field dropdown) when building the form. 

 


Use the JS here:

MktoForms :: Dynamic Labels

 


Also on a different question, does PMCF appear when building forms as a field?

Yes, it should appear in Form Editor. Note the form must be in a Program to know which Program to update.

1 reply

SanfordWhiteman
New Participant
August 17, 2021

On form load, yes (not on page load).

 

But before I tell you how to do this, I wonder why, specifically, you’re not using Program Member Custom Fields (PMCFs) for this purpose. PMCFs are purpose-built to hold program-specific (and thus event-specific) data.  Even a multipurpose PMCF is better than a multipurpose Lead field, since its data is not overwritten by subsequent events.

New Participant
August 18, 2021

Hi @sanfordwhiteman ,

The custom questions aren't always the same and can be different on each event. For example at one event we might ask for Dietary Requirements where as for a corporate golf event we might ask for the Tee Score. To avoid creating multiple fields, I want to create one (or two) field(s) that we can use and burn soon after it's used. 

Does that make sense? 

Can the label be updated at the form load with a code snippet on the hosting site? (we embed the marketo form in a wordpress site using the script).

SanfordWhiteman
New Participant
August 18, 2021

OK, but that’s still not an explanation for why you wouldn’t use PMCFs.

 

You can have a PMCF called “Event-Specific Question 1” which can be used in one Program as as Dietary Requirements while in another Program it’s labeled as Tee Score. However — and this is the power I think you’re not getting — the values will not be overwritten. And there’s no reason to overwrite such data, if anything the dietary requirements are important metrics as you plan future events.