SOLVED

Re: Change the text on the submit button

Go to solution
Anonymous
Not applicable

Re: Change the text on the submit button

Thank you! Works great!!
Anonymous
Not applicable

Re: Change the text on the submit button

Hey all -- Does this work with embedded forms? Trying to figure out how it would and not having much luck. 
Anonymous
Not applicable

Re: Change the text on the submit button

FYI we ended up adding this script to embedded forms and are able to change the submit button text easily on a per page basis, regardless of if the form is the same on every page or not.

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

<form id="mktoForm_1674"></form>

<script>

    MktoForms2.onFormRender(

    function(form) {

        var loc = document.createElement('a'); // new Location object for easier parsing

        loc.href = document.referrer;

        document.querySelector('.mktoButton').innerText = "Download"

            decodeURIComponent( loc.search.substring(1) ); // use the whole query string as button label, this is just a demo

    });

   

    MktoForms2.loadForm("//app-sj01.marketo.com", "142-FNO-891", 1674);

</script>

Anonymous
Not applicable

Re: Change the text on the submit button

So I get the program token, what token do I use in the form for the submit button label?  Is there a default value I can add as well?

SanfordWhiteman
Level 10 - Community Moderator

Re: Change the text on the submit button

It's the same token... not sure if I understand your question. In Kristin Carideo​'s answer she uses {{my.FormCTA}}. 

Also note you can pass the submit button text in the URL, like in this old chestnut: CodePen - MktoForms2 :: Language

Justin_Cooperm2
Level 10

Re: Change the text on the submit button

If you don't want to use a token, you can use Forms JS in an even simpler way to achieve this (either on external page or in a Marketo landing page):

<script>

MktoForms2.whenRendered(function (form){

  form.getFormElem()

  .find('button.mktoButton')

  .html('New button text');

});

</script>