Fetch dialog property value in js in AEM | Community
Skip to main content
Himanshu_Singhal
Community Advisor
Community Advisor
February 10, 2016

Fetch dialog property value in js in AEM

  • February 10, 2016
  • 2 replies
  • 10734 views

Hi,

I've a dialog selection box. What I need to check if the default value I've provided using  the property defaultValue and value I'll get from the selection box are equal or not!

So, to get selected value, we can get like this : 

function(dialog){ var selection = dialog.getField("<property name>"); var selectedValue = selection.value; }

Now, how can I get value in java script using the defaultValue property as name?

 

Thanks,

Himanshu

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

2 replies

Jitendra_S_Toma
Level 10
February 10, 2016

Try using function getValue(). you should be able to get that.

  1. var selValue = dialog.getField("<property name>").getValue();
  2.  
Amit_Kumar
Level 10
February 10, 2016

get path till your dialog nodes
i.e. path = /apps/../items/<property name>/defaultValue.infinity.json
and from this Json you can get the default value.
sample snippet
 

var infinityjson = CQ.HTTP.noCaching(CQ.HTTP.getPath()+<property name>+'/defaultValue.infinity.json'); var infinityjsonObject = CQ.HTTP.eval(infinityjson); var defValue = infinityjsonObject.defaultValue;