Jump to content

Hide/Show Update button when certain condition is met


Recommended Posts

I have an Update page where I want to disallow users from updating the form when the CurrentProcess != 00 or 05

I have the following script placed in the footer, it works when there is only one condition [("[@field:CurrentProcess]" != "00")] but does not work when I include [|| ("[@field:CurrentProcess]" != "05")]. 

Is there anything wrong with the script?

Thanks!

<script>
document.addEventListener('DataPageReady', function (event) {
  if (("[@field:CurrentProcess]" != "00") || ("[@field:CurrentProcess]" != "05")) {
    document.getElementsByName("Mod0EditRecord").forEach(function(elem) {
      elem.style.display= 'none';
    });
  }

});
</script>

 

Link to comment
Share on other sites

Hi @beryllium,

A standard way of achieving this without using JavaScript is below:

  • Add a Header/Footer to your page.
  • Enter following code to hide the existing Update button:

               <style>

              .cbUpdateButton {
                    display: none !important;
               }

             </style>

  • Add a new section and in it add an HTML Block.
  • Enter following code to add a custom Update button:

               <div id="update" align="center">
                         <input type="submit" class="cbSubmitButton" value="Update" />
               </div>

               image.thumb.png.c7af4866682dd8f06dce2bad89b811f8.png

 

  • Now add a Rule. It should look like below:

              image.thumb.png.24668f349199086f9b9dacdd432ae40a.png

 

                Replace "Value" with your field name.

                I hope this helps.

 

                 Regards,

 

 

Link to comment
Share on other sites

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...
 Share

×
×
  • Create New...