Dynamic Form Button Text based on response | Community
Skip to main content
New Participant
October 28, 2019
Solved

Dynamic Form Button Text based on response

  • October 28, 2019
  • 2 replies
  • 5528 views

I am working on a Marketo form and if someone checks a box to bring a guest, I would like the button to change to say "next" but if they do not check the box and do not want to bring a guest, I would like the button to just say "submit."

Is there a way to do this?

Thank you!

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

Yes, trivially done with JS: MktoForms2 :: Dynamic button label 

Unfortunately, the easiest way (as is in the demo) is to attach to the DOM change event, which I generally discourage. You could use a dummy Visibility Rule instead (not what Josh is suggesting, but merely using the VR to trigger a Marketo Forms API event) and which would allow you to listen for whenRendered instead of generic change.

2 replies

nmdomingAuthor
New Participant
October 28, 2019

Thank you, this is all very helpful! 

SanfordWhiteman
New Participant
October 28, 2019

OK, can you mark my answer as Correct pls, since it directly meets the original goal? Thanks.

Josh_Pickles
New Participant
October 28, 2019

Hi Nicole,

The default form tool within Marketo won't allow for this. You can likely edit the form function outside of Marketo, however, I believe you can get a similar result by using Visibility Rules.

I presume that by hitting next will take then to a new form page where they can add in the guest details? If you add the relevant fields (Guest Name, Guest Email etc) as fields underneath your "Bring a Guest" check box, you can use visibility rules on the form to hide Guest Name/Guest Email and set them to only appear once Bring a Guest has been checked.

For more information on this, check the Marketo docs here: Dynamically Toggle Visibility of a Form Field - Marketo Docs - Product Documentation 

nmdomingAuthor
New Participant
October 28, 2019

Hi Josh,

That is correct. We would like it to go to a new page with a new form so we can capture their first name, last name, email and company name in the same fields rather than having guest fields. 

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
October 28, 2019

Yes, trivially done with JS: MktoForms2 :: Dynamic button label 

Unfortunately, the easiest way (as is in the demo) is to attach to the DOM change event, which I generally discourage. You could use a dummy Visibility Rule instead (not what Josh is suggesting, but merely using the VR to trigger a Marketo Forms API event) and which would allow you to listen for whenRendered instead of generic change.