0 Replies Latest reply: May 18, 2012 9:14 AM by TyroneCQ55 RSS

    Dynamically setting the rootPath property for the xtype = pathfield

    TyroneCQ55

      If I set the property rootPath = content/training, then the my fieldConfig widget, xtype=pathfield will allow the user to set the page path from /content/training

       

      I want to set it dynamically to my actual page path

       

      Here is my dialog.xml file

      <?xml version="1.0" encoding="UTF-8"?>

      <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:Dialog"

          title="Path Multifield"

          xtype="dialog">

          <items

              jcr:primaryType="cq:Widget"

              xtype="tabpanel">

              <items jcr:primaryType="cq:WidgetCollection">

                  <tab1

                      jcr:primaryType="cq:Panel"

                      title="Tab 1">

                      <items jcr:primaryType="cq:WidgetCollection">

                          <multipath

                              jcr:primaryType="cq:Widget"

                              fieldLabel="Sessions:"

                              name="./paths"

                              xtype="multifield">

                              <fieldConfig

                                  jcr:primaryType="nt:unstructured"

                                  itemId="sessionPath"                         

                                  xtype="pathfield"/>

                          </multipath>

                      </items>

                  </tab1>

              </items>

          </items>

      </jcr:root>

       

      In my component.jsp I have th following code

       

      <%@include file="/libs/foundation/global.jsp"%>

      <%

      String[] paths=properties.get("paths",String[].class);

      out.write("<h2>Component</h2><br>");

       

      %>

       

      Current Page Path = ${currentPage.path}

      <script>

              // provide a path selector field with a repository browse dialog

      var pathfield = new CQ.form.PathField({

          rootPath: ${currentPage.path},

          predicate: "nosystem",

          showTitlesInTree: false

      });

      </script>

       

      What do I have to do to get the Ext JS to work and dynamically set the rootPath

       

       

      Thanks

      Tyrone