Jump to content
Sign in to follow this  
Wernon

Dynamic hide/show in dependent of the other field value

Recommended Posts

 

I have an issue with the case on the report page,  where the field should be active for adding or visible (hidden before).

 

Details: I have a dropdown for answer revision with three status variants: Pending, Approved and Not Approved. The changes are provided via inline edit.

If the message status is not approved I should be able to write a comment, but for the other cases window should not appear or should not be editable. 

 

It would be nice if somebody can help me with this case.

Thanks.

Share this post


Link to post
Share on other sites

This solution is for hiding Inline edit elements for certain conditions on Report Data Page.
       For Hiding element with "Comment" label if value in dropdown with "Approved" label is not equal "Not Approved" If need can applied more complex conditions by  modifying If Statemets.

 

<script type="text/javascript">
        
        document.addEventListener('DOMSubtreeModified', function(){
            var InlineEditApproved=document.getElementsByName("InlineEditApproved")[0];
            var InlineEditComment=document.getElementsByName("InlineEditComment")[0];
            if(InlineEditApproved && InlineEditComment){
                if(InlineEditApproved.value!="Not Approved"){
                    InlineEditComment.style.display="none";
                }
                InlineEditApproved.addEventListener('change', function(){
                                if (InlineEditApproved.value=="Not Approved"){
                                    InlineEditComment.style.display="block";
                                }
                                else{
                                    InlineEditComment.style.display="none";
                                }
                });
            }else{
                return false;
            }
        });
         </script>

Info:

        InlineEditApproved-InlineEdit+(Name of dropdown)
        InlineEditComment-InlineEdit+(Name of comment label)
        Not Approved-Condition of dropdown element can be modified

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