NeoInJS Posted October 18, 2016 Report Share Posted October 18, 2016 Hello everyone - I have a Calendar dataPage and I added a Calculated field and a link in it. I need a JS to hide the Link I created if the Calculated Field is not NULL or blank Quote Link to comment Share on other sites More sharing options...
nightowl Posted January 2, 2017 Report Share Posted January 2, 2017 Hi NeoInJS, Please try the following: Create a calculated field. In this example, label it as CalcField. Put some formula in the calculated field that either resolved to some value or to NULL. Then, next to the calculated field in Step #1, create the HTML block that will contain the link. Create the HTML link inside that HTML block, with Source view enabled: <a href="YOUR_URL" id="link-id-[@field:YOUR_RECORD_ID]">LABEL</a> Please take note that the HTML link should have an ID as shown above for easy reference in JavaScript. You can also choose a different ID prefix aside from link-id-, but you have to update the script below. Next to the HTML block from Step #3, create another HTML block with Source view enabled. Then put this script inside the HTML block from Step #5: <script> var link = document.getElementById("link-id-[@field:Lap_ID]"); var htmlBlock = link.parentElement; var entry = htmlBlock.parentElement; var calcFieldIndex = 5; var calcField = entry.getElementsByClassName("cbResultSetData")[calcFieldIndex - 1]; if (calcField.value !== null) { htmlBlock.style.display = "none"; } </script> For the calcFieldIndex variable, please update the actual value according to the screenshot below: Hope this helps. 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.