SOLVED

Re: Hide the submit button based on a value in a form

Go to solution
SanfordWhiteman
Level 10 - Community Moderator

Re: Hide the submit button based on a value in a form

Hi Ed,

 

If I were to switch it up now, I'd probably do it like https://codepen.io/figureone/pen/7240a8d954ad36207682ebd49289ee17, which doesn't require any special prep in Form Editor. 

edmerrick
Level 1

Re: Hide the submit button based on a value in a form

Thank you- looks much cleaner!

Vincent_Paget
Level 1

Re: Hide the submit button based on a value in a form

Hi Sanford, thanks for your response.

 

I've got it all working apart from one part. When the form initially loads, the submit button is hidden as the default option has no value associated with it.

 

I tried updating the showSubmitWhen values to also include "" but the submit button is still hidden when the form initially loads. If I select an option that shows the submit button and revert back to the default "select" option the submit button will be visible, but I can't get it to show when the form initially loads.

Ideally, I would like to show the submit button by default as it makes it obvious to the visitor that it is a form. 

 

What would be the best way to show the submit button by default on load?

SanfordWhiteman
Level 10 - Community Moderator

Re: Hide the submit button based on a value in a form


What would be the best way to show the submit button by default on load?


For that, just switch the display style for the undecorated element (without the special data-show-submit attribute):

.mktoForm[data-show-submit="false"] .mktoButtonRow {
   display: none;
}
.mktoForm .mktoButtonRow,
.mktoForm[data-show-submit="true"] .mktoButtonRow {
   display: inline-block;
}

 

Vincent_Paget
Level 1

Re: Hide the submit button based on a value in a form

Thanks for your help Sanford - Got it working perfectly now!

Thomas_Rosen3
Level 1

Re: Hide the submit button based on a value in a form

Sanford Whiteman‌ It's been a while. Hope all is well.

I'm trying this code out but messed it up somewhere.

I think its an issue with the naming on the RT element but not 100% sure.

Any help is greatly appreciated.

-Thomas