Skip to main content
Level 3
September 2, 2016

How to read a node value in dropdown listener event

  • September 2, 2016
  • 2 replies
  • 4723 views

Hi,

I have requirement to design a page with two controls 1. drop down list 2. Rich text box.

The rich text box value is dependent on selected drop down value. I.e Based on the drop down selected item, a node value (under content/mypage/jcr:content) to be read into the rich text box.

I understand from few sites that we can achive this through the 'listener' selectionchanged event. However I am struggling to read the node value and assign it to the rich text box.

Can anyone please guide me? or provide an example which meets my requirement.

Thank you in advance

Kishore

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

smacdonald2008
Level 10
September 2, 2016
Level 3
September 2, 2016

Thank you. This is very much helpful.

However I still need to understand how to get a node value (which is under content/mypage/jcr:content/mynode) through javascript.

For instance my dropdown has two values (value1 and value2) and if select value1 should read 'mynode' value and assign it to the text field.

Can you please help?

smacdonald2008
Level 10
September 2, 2016

Is your dropdown in a component dialog like in the article.

kautuk_sahni
Adobe Employee
Adobe Employee
September 5, 2016

Hi 

I am not sure, if this will help you.

But, there is something called "Custom Validation of Dialog" in AEM, you can create a custom validation for dialog fields. It just require CSS sector.

So using this concept, you can trigger some code. 

Link:- http://www.nateyolles.com/blog/2016/02/aem-touch-ui-custom-validation

So, here for selection you can trigger your piece of code. This code would be fetching the value from the dialog fields and sending or populating wherever you want.

 

I hope this would be of some help to you.

~kautuk

Kautuk Sahni
Level 3
September 5, 2016

Hi,

Thank you for your response. 

Seems the example given is for touch UI but I am looking for classic UI support.

Can you please tell me, how to read a node under jcr:content from either javascript or jsp?

Thanks,

Kishore

Subba_Rao_Adavi
September 6, 2016

Below snippet will gives you current node path Javascript  for the selection change event 
selectionchanged : function(el,val,check){
       var dialog = el.findParentByType('dialog');//gives dialog
       console.log(dialog .path);//gives current node path
       }
       

Hope this may help you for more details please refer link