Jump to content
  • 0

Hide delete submission button on tabular report


RonAnderson

Question

Hi, I have a tabular report which has 3 buttons on the Search Result.

  1. View Details (Standard Button)
  2. Delete (Standard Button)
  3. Copy (Custom Button)

I want to hide the Copy button if the condition "PAT" is present in the "In Scope" field. I'm able to hide the "Delete" button with the following code which is contained in an HTML block:-

<script>
var condition = ("[@field:In_Scope]" == "PAT");
hideDelete([@cbRecordIndex], condition);
</script>

But when I change the "hideDelete" in the above code to "hideCopy" it doesn't work and the "Copy" button is still visible. Here's a screenshot of the output.

Any advice to correct would be really welcomed.

Hide_Copy_Button_Diagram.png

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 1

Hi @RonAnderson - since your link is in the app parameter, could you try to add the style directly on the app parameter? 

<a href="https://www.assets55.com/mccc/copy.html?ID=[@field:Record_Ref_ID]

" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no'); return false;" style="display:[@calcfield:1] !important;">Copy</a>
Link to comment
Share on other sites

  • 0

Hi @RonAnderson,

Here is a solution that I can think of since you have a custom copy button.

1. Create an HTML block and encapsulate your button with <div> like this:

<div id='copy'>
<a href=''>Copy</a>
</div>

image.png.9c97ed7fe7cb87a6f73eac1598981ac6.png

 

2. Create a second HTML block and put this code:

<script>

document.addEventListener('DataPageReady', function (event) {

//Condition to hide the copy button
if ("[@field:In_Scope]" == "PAT") {
document.getElementById("copy").style.display = "none";
};

});

</script>

 

Your output should be similar to this:

image.png.dfcbbe162e4159d5ec7c91d55208d912.png

 

I hope this helps!

Link to comment
Share on other sites

  • 0

Hi @RonAnderson - you can also achieve this by using a calculated field. You can add a calculated field in your report and use this formula: 

CASE WHEN [@field:Service_Site] = 'PAT'
THEN 'None'
END

Then, on your HTML block where the copy button or link is added, you can add a style and select the calculated field you have created. 

<a href="#" style="display:[@calcfield:1]!important;">Copy</a>

And here's the sample output:

image.png.aee84b6fb970d2393fc0c29949674983.png

Link to comment
Share on other sites

  • 0

Hi @Kronos and @autonumberThank you both so much for taking the time to suggest a solution. Unfortunately I couldn't get either to work. Could it possibly have something to do with the "Copy" being a link to another datapage and so should be handled not as a string? If this changes the code you've supplied I'd gratefully appreciate a further remedy.

Also, the link is referenced to an item in the App Parameter section. Here's the link code:-

<a href="https://www.assets55.com/mccc/copy.html?ID=[@field:Record_Ref_ID]

" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no'); return false;">Copy</a>

I've tried numerous manipulations of both code suggestions but my limited knowledge of JS I just couldn't find a fix. Here's a screenshot of the results:-

AttemptedFix.png

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
Answer this question...

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