beryllium Posted June 16, 2022 Report Share Posted June 16, 2022 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> Quote Link to comment Share on other sites More sharing options...
PotatoMato Posted June 16, 2022 Report Share Posted June 16, 2022 Hi @beryllium, you may check this forum post for reference: Quote Link to comment Share on other sites More sharing options...
BaySunshine Posted June 16, 2022 Report Share Posted June 16, 2022 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> Now add a Rule. It should look like below: Replace "Value" with your field name. I hope this helps. Regards, KG360, Lepidoptera and GrumpyRick 2 1 Quote Link to comment Share on other sites More sharing options...
GrumpyRick Posted September 18, 2022 Report Share Posted September 18, 2022 Excellent option. Thanks. Quote Link to comment Share on other sites More sharing options...
KG360 Posted March 18 Report Share Posted March 18 On 6/17/2022 at 1:28 AM, BaySunshine said: 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> Now add a Rule. It should look like below: Replace "Value" with your field name. I hope this helps. Regards, Very nice solution. I tried it, and it works, but I could not do the same with the Delete button. I used a similar script, but it might be the wrong syntax. <div id="delete" align="center"> <input type="delete" class="cbDeleteButton" value="Delete" /> </div> I tried it in the same HTML block as the Update button and in a separate HTML block; neither worked for the Delete button. any further guidance is much appreciated! Also: How 'safe' is hiding the button, the Delete in particular. Is it sufficient to Hide or must one also disable? KG Quote Link to comment Share on other sites More sharing options...
SushiPizza Posted March 18 Report Share Posted March 18 2 hours ago, KG360 said: Very nice solution. I tried it, and it works, but I could not do the same with the Delete button. I used a similar script, but it might be the wrong syntax. <div id="delete" align="center"> <input type="delete" class="cbDeleteButton" value="Delete" /> </div> I tried it in the same HTML block as the Update button and in a separate HTML block; neither worked for the Delete button. any further guidance is much appreciated! Also: How 'safe' is hiding the button, the Delete in particular. Is it sufficient to Hide or must one also disable? KG Hi @KG360, Please check this forum post for a custom delete button. A custom delete button will not work without additional scripting. Also, you need to have the type attribute as type="button" instead of type="submit" in the button code from this post. Regards, SP KG360 1 Quote Link to comment Share on other sites More sharing options...
KG360 Posted March 18 Report Share Posted March 18 These solution from @CoopperBackpack work perfekt! I liked that it was not necessary to involve any other elements than the authentication field and the record creator ID. When they are the same the user have editing rights, if not user can only view the content. I also disabled the fields that could otherwise be edited. Quote Link to comment Share on other sites More sharing options...
cianelectric Posted May 29 Report Share Posted May 29 On 6/17/2022 at 12:28 AM, BaySunshine said: 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> Now add a Rule. It should look like below: Replace "Value" with your field name. I hope this helps. Regards, This is a great option and really helped me! The only problem I now have though is that the custom button (which I labelled as "Mark Result as Viewed" rather than "Update") now appears on my PDF download... Is there any way to hide it? I noticed that in the PDF download it looks like a grey button rather than blue onscreen as I guess it's ignoring any localization for the datapage. So I wondered if there is any code I could add perhaps to make all aspects of the button white, and then this might avoid it being visible on the PDF? Thanks! Update... I answered my own question :-) The code below in the HTML conditional section causes the button to be invisible on the PDF report! <style> input[type=button], input[type=submit], input[type=reset] { background-color: #FFFFFF; border: none; color: white; padding: 16px 32px; text-decoration: none; margin: 4px 2px; cursor: pointer; } </style> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.