Expand my Community achievements bar.

SOLVED

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

Avatar

Level 2

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);

  });

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
6 Replies

Avatar

Level 10

Talked to our AEM TOuch UI Experts on thisl Response was:

for the listener to register you can add it on “add” of mutlfield, so something like…

var $multifield = $("#my_mult_field");

$multifield.find(".js-coral-Multifield-add").click(function(){
var textfield = //find the textfield in multifield
});

Avatar

Level 10

We will also put out a HELPX article on this use case too in early 2018.

Avatar

Level 2

thanks

but i need events on multifield keyup to check entered string (vanity-url ) is unique to the project ..

Avatar

Level 2

I am also having the same issue. I am trying to add minimum, maximum limit configuration extension to Coral 3 Multifield - 6.4 but it is not working.

Avatar

Correct answer by
Community Advisor