Jump to content

I want to hide some fileds based on the selection of the dropdown


Recommended Posts

I have a dropdown and want that when user select some particular option then two fileds should become hidden. I am using the following script but it is not working 

<script>
document.addEventListener('DataPageReady', function() {
    var dpoptionElement = '[@field:Style_1Style]';
    var dadop2 ='[@field:Style_1Wing]';
    var dadop3 = '[@field:Style_1WingWall]';
    
    // Check if the element exists before trying to attach an event listener
           
    if (dpoptionElement === 'Winged (BH9)' || dpoptionElement === 'Deep Diamond Button (BH7)') {
        dadop2.style.display = 'none';
        dadop3.style.display = 'none';
    }
});
</script>

 

please anyone have some solution

Link to comment
Share on other sites

Hello @Mushigee2266,

It looks like this can be achieved by using Caspio's built-in features. You can utilize Rules if this is a Form, Search page, or Details page.

https://howto.caspio.com/datapages/forms/conditional-forms/

If there is a reason why Rules doesn`t work, please provide more details. Also, please specify the DataPage type where you need to implement this solution.

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...
×
×
  • Create New...