4 Replies Latest reply on Dec 22, 2017 8:53 AM by smacdonald2008

    how to add listeners to multi-field text-field  for touchui

    mayurij73490671

      help would be appreciate !!

      this below approach is not working for multifield texfield listeners .

       

      cq:dialog.xml for multifield

       

      <vanityurl

                                          cq:showOnCreate="{Boolean}false"

                                          jcr:primaryType="nt:unstructured"

                                          jcr:title="Vanity URL"

                                          sling:resourceType="granite/ui/components/foundation/form/fieldset">

                                          <items jcr:primaryType="nt:unstructured">

                                              <vanitypath

                                                  jcr:primaryType="nt:unstructured"

                                                  sling:resourceType="granite/ui/components/foundation/form/multifield"

                                                  cq-msm-lockable="sling:vanityPath"

                                                  fieldLabel="Vanity URL"

                                                  renderReadOnly="{Boolean}true">

                                                  <field

                                                      jcr:primaryType="nt:unstructured"

                                                      sling:resourceType="granite/ui/components/coral/foundation/form/textfield"

                                                      name="./sling:vanityPath"

                                                    class="vanityPathClass"

                                                      required="{Boolean}true"/>

                                              </vanitypath>

                                           

                                          </items>

                                      </vanityurl>

       

       

      listener.js

       

      (function (document, $, ns) {

        "use strict"; 

       

        $(document).on("keyup", ".vanityPathClass", function (e) {

            var path = $(this).closest("form.foundation-form").attr("action").replace("/_jcr_content","");

            var vanityTitle=$(this).val();

       

      console.log('----- bar -----');

       

       

      console.log('----- path -----'+path);

       

       

      console.log('----- vanity -----'+vanityTitle);

        });