title: How to add cq:listener to a component
body: <p>I am trying to add <code>cq:listener</code> <a href="https://docs.adobe.com/docs/en/cq/5-5/developing/components/edit_config.html#cq:listeners" rel="nofollow noreferrer">https://docs.adobe.com/docs/en/cq/5-5/developing/components/edit_config.html#cq:listeners</a> to my component so that after selecting an asset and clicking "ok", the page refreshes. </p>
  
  <p>This is how the component looks on the screen where I select an asset and click ok.</p>
  
  <p><img src="https://i.stack.imgur.com/ZyepF.png" alt="enter image description here"></p>
  
  <p>In my code, the <code>dialog.xml</code> looks like this</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
      jcr:primaryType="cq:Dialog"
      xtype="dialog"&gt;
      &lt;items
          jcr:primaryType="cq:Widget"
          xtype="tabpanel"&gt;
          &lt;items jcr:primaryType="cq:WidgetCollection"&gt;
              &lt;tab1
                  jcr:primaryType="cq:Panel"
                  title="Tab"&gt;
                      &lt;items
                          jcr:primaryType="cq:WidgetCollection"&gt;
                              &lt;asset-reference
                                  jcr:primaryType="cq:Widget"
                                  fieldLabel="Foo Bar:"
                                  fieldDescription="Select the asset under /content/dam/foo-sync"
                                  name="./fileReference"
                                  xtype="pathfield"
                                  rootPath="/content/dam/evernote-sync"/&gt;
                      &lt;/items&gt;
              &lt;/tab1&gt;
          &lt;/items&gt;
      &lt;/items&gt;
  &lt;/jcr:root&gt;
  </code></pre>
  
  <p><code>_cq_editConfig.xml</code> looks like this</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
      jcr:primaryType="cq:EditConfig"&gt;
      &lt;cq:dropTargets jcr:primaryType="nt:unstructured"&gt;
          &lt;fileReference
              jcr:primaryType="cq:DropTargetConfig"
              accept="[text/.*]"
              groups="[media]"
              propertyName="./fileReference"/&gt;
      &lt;/cq:dropTargets&gt;
  &lt;/jcr:root&gt;
  </code></pre>