You are viewing limited content. For full access, please sign in.

Question

Question

Can I hide the Submit button without tying it to a field on the form?

asked on February 26, 2021

I have a process to allow our members to vote for the Board of Directors. Once voting closed I unpublished the election form, but I did not want anyone clicking the link to vote just to get an error page. I created a form with an HMTL field that had a picture that voting was closed, so I would like to hide the Submit button since there is nothing to submit. 

All of the CSS and java script I found tied the hide to a if/then idea on a field on the form. So can it be done without a question on the form?

 

0 0

Answer

SELECTED ANSWER
replied on February 26, 2021

I have a process that doesn't actually go anywhere or do anything, it's basically a report (it pulls in some database values and displays them in a specific manner to the user) - so it never needs to be submitted, so I always hide the submit button using Javascript.

$(document).ready(function () {
  $('.Submit').hide();
});

It doesn't actually prevent it from submitting if you have a really crafty user, but it definitely makes it difficult.

1 0
replied on February 26, 2021

Worked great, thank!

1 0
replied on February 26, 2021

Fantastic!  Glad it worked for you.

@████████'s suggestion is a fantastic option as well, hiding it through CSS instead of Javascript.

Don't forget to mark the question as answered.  Have a great day!

1 0
replied on February 26, 2021

Hey Matthew,

I have some forms I use as reports as well, and if you really want to make it tough, even for "crafty" users, you could go even more extreme.

$(document).ready(function(){
  $('form').removeAttr('action method enctypex');
  $('.Submit').remove();
})
1 0
replied on February 26, 2021

I haven't had problems (yet), but I love learning new stuff like this - that's nice!

Thanks @████████!

0 0

Replies

replied on February 26, 2021
.Submit{display:none};

 

2 0
You are not allowed to follow up in this post.

Sign in to reply to this post.