Hide the SUBMIT button based on Radio Button? | Community
Skip to main content
New Participant
November 25, 2016
Solved

Hide the SUBMIT button based on Radio Button?

  • November 25, 2016
  • 1 reply
  • 3880 views

I am trying to find a way to hide this SUBMIT button but have not found anything applicable in the case of this form located here:

Become A Customer

If I select option 3 "I need additional access...", then I would like the SUBMIT button to vanish.

Now I have asked this question before and the solution worked, but I cannot find it since the Marketo Community forum move.  In fact, quite a few of my posts have vanished as well!  Oh well.

I remember it was a simple solution.  Since this page went corrupt, and I had to quickly rebuild, I lost the code, in the meantime, I put a silly solution in place that just add's tons of spaces to shoot the submit button down below visibility.  LOL!

Your help is definitely appreciated.

Best answer by SanfordWhiteman

Yep...

MktoForms2.whenRendered(function(form){

  var formEl = form.getFormElem()[0],

      buttonEl = formEl.querySelector('.mktoButtonRow');

  var addlAccess = !!(form.getValues()['Lead_Source_Type__c'] == "I need addtional access to my account");

  if ( addlAccess ){

    buttonEl.style.display = 'none';

  } else {

    buttonEl.style.display = 'block';

  }

});

Note this is very quick and dirty. A more pro solution would use CSS classes and a microframework to manage this special kind of visibility rule.  Also note the typo on the form!

1 reply

Josh_Hill13
New Participant
November 25, 2016

Do you have a developer? Maybe @Sanford Whiteman​ can help.

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
November 25, 2016

Yep...

MktoForms2.whenRendered(function(form){

  var formEl = form.getFormElem()[0],

      buttonEl = formEl.querySelector('.mktoButtonRow');

  var addlAccess = !!(form.getValues()['Lead_Source_Type__c'] == "I need addtional access to my account");

  if ( addlAccess ){

    buttonEl.style.display = 'none';

  } else {

    buttonEl.style.display = 'block';

  }

});

Note this is very quick and dirty. A more pro solution would use CSS classes and a microframework to manage this special kind of visibility rule.  Also note the typo on the form!

New Participant
November 30, 2016

Thanks Josh and Sanford.  I will review this and report back, but I don't see why this shouldn't work!  Looks similar to what I used to have.  Just kept it simple was sufficient for the purposes of this form.

But wow, the typo is crazy. We use software to track typo's on our site, and I am stunned it did not catch that.  We should cancel our subscription and hire you! Hahaha!

Thanks again!

When life lends you lemons, make applesauce.