Thursday, October 17, 2013

Attach listeners to widgets in CQ5 / AEM

Follow the below steps to create or attach listeners (javascript event listeners) to any widget in CQ5 / AEM.

  1. Create a node by name "listeners" of type "nt:unstructured"
  2. Find out the events which can be attached to a widget. You can find the list of events from the CQ Widget API documentation. Click here to visit.
  3. e.g. The "pathfield" widget has got one event called "dialogclose". This event is fired when user selects any link from the browse field & clicks OK.
  4. To attach this add one property by name "dialogclose" to the listeners node. The value should be any javascript function call. 
    1. e.g. function(){ console.log("You have selected a link in path field"); }
  5. Please see below  image for reference.




2 comments:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.
    Devops Training courses
    Devops Training in Bangalore
    Best Devops Training in pune
    Microsoft azure training in Bangalore
    Power bi training in Chennai

    ReplyDelete
  2. I just recently discovered your blog and have now scrolled through the entire thing several times. I am very impressed and inspired by your skill and creativity, and your "style" is very much in line with mine. I hope you keep blogging and sharing your design idea

    data science training in chennai

    data science training in velachery

    android training in chennai

    android training in velachery

    devops training in chennai

    devops training in velachery

    artificial intelligence training in chennai

    artificial intelligence training in velachery

    ReplyDelete