Jump to content

Java Script to Hide the Update Button


Recommended Posts

Hello 

 

I need to have a details page on and update form that has no action buttons at the bottom.  I was able to hide the BACK button with the following code:

<style>

 input[id^="Mod0CancelRecord"]{
display: none !important;
}
</style>

I also need to hide the UPDATE button as well - I have not be successful modifying the above code to accomplish this.   Can anyone help?

 

Thanks!!!

Link to comment
Share on other sites

It would be better to hide buttons from the Style directly.

  1. Create a new Style and apply it to the datapage you would hide the buttons from.
  2. Go to Source tab inside the new style and then select "All" from the left tree options under Datapage Elements section.
  3. Look for the type of container you are trying to hide, selections might be: cbSubmitButtonContainer, cbBackButtonContainer, cbDeleteButtonContainer, cbSearchButtonContainer, cbLoginButtonContainer, cbUpdateButtonContainer, cbPasswordRecoveryButtonContainer, cbPasswordResetButtonContainer
  4. Find what you are looking for and add the following line inside the class attributes: display: none;

That way you will be hidding the buttons you want from the datapages you want without using JS.

I hope it helps

Link to comment
Share on other sites

  • 1 year later...

 Keep in mind hiding these buttons through CSS will not disable them. If anyone presses 'Enter' they will be able to 'click' the button.

You need JavaScript to disable it completely and then use CSS for hiding, or you can use JavaScript for both. For Submission, you do it like:

<script>

document.getElementsByClassName('cbSubmitButton')[0].disabled = true;
document.getElementsByClassName('cbSubmitButton')[0].style.display = 'none';

</script>


Update Form/Details Page

<script>

document.getElementsByClassName('cbUpdateButton')[0].disabled = true;
document.getElementsByClassName('cbUpdateButton')[0].style.display = 'none'; 

</script>


If you have multiple forms on a single Webpage, just change 0 to any number depending on the order of the forms, 0 means it's the first form, and so on.

 

If you just really want to hide, then just remove the 1st line.

Link to comment
Share on other sites

  • 6 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...