Jump to content
Sign in to follow this  
astroboy

Hide button when checkbox is not checked

Recommended Posts

I have a virtual field that is set as a checkbox and virtual field for the button. If the checkbox is not checked it will hide the virtual field which has the button in it. How do I achieve this inside the DataPage?

Share this post


Link to post
Share on other sites

HI @astroboy,

This can be done using JavaScript. Below is the code which you can refer to:

 

<script>
document.addEventListener("DataPageReady", function() {

button = document.querySelector('input[id^="Test"]');

if (document.getElementById("cbParamVirtual1").checked) {
button.style.display = "inline";
}
else {
button.style.display = "none";
}

document.getElementById("cbParamVirtual1").onclick = function() {

if (document.getElementById("cbParamVirtual1").checked) {
button.style.display = "inline";
}
else {
button.style.display = "none";
}}});
</script>

I hope this works.

- Barbie

Share this post


Link to post
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...
Sign in to follow this  

×
×
  • Create New...