Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Cq:Listener for mtmulticomposite custom xtype

Avatar

Community Advisor

Hi All,

We have requirement to have a checkbox which decides to show or hide the textfield accordingly in multicomposite custom xtype

I wrote a listener which works for only selection change but not on dialog load.

Can i get any help how can we write the same listener functionality by onload listener on dialog.

I tried in many ways for accessing the checkbox values but not able to get the values help me in how to fetch the checkbox values from multicomposite field.

Please also find the required files attached.

Thanks,

Mani Kumar

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi 

Please have a look at this reference article, this may help you.

//Get value on dialog load.

Link:- http://theanswerweb.com/data31/2015/07/25/fetch-the-value-of-a-dropdown-widget-on-dialog-load-in-cq5...

You may use loadcontent listener for the same.

 

And to fetch value from dialog,

Link:- http://aem.matelli.org/fetching-properties-from-dialogs/

Getting value of checkbox from dialog :-= http://stackoverflow.com/questions/8710832/getting-value-of-checkbox-from-dialog

//

This works for me

Properties for dialog field:

name: ./checkbox1 type: checkbox xtype: selection

code:

boolean isChecked1 = properties.get("checkbox1", false);

 

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

3 Replies

Avatar

Correct answer by
Administrator

Hi 

Please have a look at this reference article, this may help you.

//Get value on dialog load.

Link:- http://theanswerweb.com/data31/2015/07/25/fetch-the-value-of-a-dropdown-widget-on-dialog-load-in-cq5...

You may use loadcontent listener for the same.

 

And to fetch value from dialog,

Link:- http://aem.matelli.org/fetching-properties-from-dialogs/

Getting value of checkbox from dialog :-= http://stackoverflow.com/questions/8710832/getting-value-of-checkbox-from-dialog

//

This works for me

Properties for dialog field:

name: ./checkbox1 type: checkbox xtype: selection

code:

boolean isChecked1 = properties.get("checkbox1", false);

 

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 10

Hi,

Where you are passing reference to dialog in method loadcontent() ?

you should use function(dialog){}

Thanks

Avatar

Community Advisor
Hi sahni Thanks for the reply.Solution you suggested will work for OOTB Widgets but this Widget we ate using mtmulticomposite which is customised in that widget I am unable to fetch the values