Remove form fields on specific page(s) | Community
Skip to main content
Dennis_Thomsen
New Participant
March 9, 2022
Solved

Remove form fields on specific page(s)

  • March 9, 2022
  • 1 reply
  • 2352 views

Hello,

 

We use a global form on multiple guided template landing pages where forms are inserted via the lp editor. For a specific landing page we want to use same global form but wish to remove a couple of fields (set as mandatory in the form editor).

 

I tried searching the community but couldn’t find a solution. I assume this can be done with javascript but I’m not sure how? Can any one point me in the right direction on how to achieve this?

 

BR
Dennis

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

If they're required fields, you can't just remove them with JS.

 

But you can manage their visibility with Visibility Rules. A field that's marked Required but not shown due to VRs is not required - which is good.

 

You can in turn base the visibility on another Hidden field that's used only for Visibility Rule management. (It has to exist in Marketo, but has no meaning on the server, it's only used on the browser side.)

 

For example, the field could be called Field Visibility Manager.

 

The VRs say If field Field Visibility Manager is "Special Page" then Hide field Country.

 

You set the Field Visibility Manager value itself using the Forms 2.0 setValues method, only on your special page.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
March 9, 2022

If they're required fields, you can't just remove them with JS.

 

But you can manage their visibility with Visibility Rules. A field that's marked Required but not shown due to VRs is not required - which is good.

 

You can in turn base the visibility on another Hidden field that's used only for Visibility Rule management. (It has to exist in Marketo, but has no meaning on the server, it's only used on the browser side.)

 

For example, the field could be called Field Visibility Manager.

 

The VRs say If field Field Visibility Manager is "Special Page" then Hide field Country.

 

You set the Field Visibility Manager value itself using the Forms 2.0 setValues method, only on your special page.

Dennis_Thomsen
New Participant
March 10, 2022

Hello Sanford,

 

That worked perfectly - great solution. Thanks for your help 🙏

 

BR
Dennis

SanfordWhiteman
New Participant
March 10, 2022

Great!