Expand my Community achievements bar.

SOLVED

Metadata schema changes

Avatar

Level 2

Hi

I want to enable / disable the fields on metadata editor page. For example i should have 1 dropdown and 3 text boxes. If i select yes value from the first drop down then i have to hide or disable the 3 text boxes. If i select no then i should enable those again. Please help me to do this.

1 Accepted Solution

Avatar

Correct answer by
Employee

The link below covers your topic and many more with example code:

https://docs.adobe.com/docs/en/aem/6-0/develop/components/widgets.html

View solution in original post

7 Replies

Avatar

Correct answer by
Employee

The link below covers your topic and many more with example code:

https://docs.adobe.com/docs/en/aem/6-0/develop/components/widgets.html

Avatar

Level 2

First of all thanks for your response. I gone through link and It is look like a classic UI or wcm part. But i am talking about coral UI. We will add / change the metadata nodes under metadata schema editor page ryt that one.

Avatar

Level 4

Please check /libs/dam/gui/components/admin/propertiesform/clientlibs/propertieseditor/js/propertieseditor.js

Avatar

Level 2

The mentioned above js getting called but what can we do with that.pls guide me. I am new to cq5.

Avatar

Level 4

Well , you need to write logic in this js file for hide/show . Try something like below :

var yourFields = $('[name="./jcr:content/metadata/yourfiledname"]');
 yourFields .each(function(index, value) {                       
                        var $value = $(value);

                          for(var i = 0; i< yourFields .length;i++){
                                           
                                            $value.addClass('hide');
                                          
                                        }
                    });

Avatar

Level 2

thanks i will try this. Also please help me to write selection change function for the dropdown which is in the metadata properties page.

Avatar

Level 2

See below my fields are like this. I have attached UI and html.   Also I have tried with the above code you have provided.  Here I am getting myFields as object. I am unable to read that. Also the alert "Inside" is not getting displayed(not going inside for each loop)

    var myFields = $('[name="./jcr:content/metadata/myProperty"]');
    alert(myFields);
 myFields.each(function(index, value) { 
    alert("Inside");
                        var $value = $(value);
                         for(var i = 0; i< yourFields .length;i++){

                                           $value.addClass('hide');

                                       }
                    });

 

Please help me to do this.Thanks in advance.