Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
SOLVED

Update using javascript for coral touch ui tag based auto complete

Avatar

Level 8

Hi,

Based on the link Update using javascript for coral touch ui tag based auto complete

I am populating for dialog  on load using $(#TagIdcomp).find('ul.js-coral-Autocomplete-selectList > li[data-value="'+tagVal+'"]').click();

  But  on submit i need to capture the values from autocomplete dialog  in JavaScript. So that i could process those in java using ajax

Could you please provide inputs as what will the javascript code will be very helpul.

I have the tag

<tagRegion

         jcr:primaryType="nt:unstructured"

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

         fieldLabel=" Tag"

                                        multiple="{Boolean}true"

         name="../../tagsRegion"

        granite:id="TagIdcomp"

         mode="contains">

          <datasource

           jcr:primaryType="nt:unstructured"

           sling:resourceType="cq/gui/components/common/datasources/tags"/>

          <options

           jcr:primaryType="nt:unstructured"

           sling:resourceType="granite/ui/components/coral/foundation/form/autocomplete/list"/>

          <values

           jcr:primaryType="nt:unstructured"

           sling:resourceType="granite/ui/components/coral/foundation/form/autocomplete/tags"/>

                                    </tagRegion>

Thanks.

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

var field = $form.find("input[name='../../tagsRegion']");

field.each(function( index ) {

   $( this ).val();

});

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

var field = $form.find("input[name='../../tagsRegion']");

field.each(function( index ) {

   $( this ).val();

});

Avatar

Level 8

Thanks Arun. Your response was very useful.

For multi selection values  i used

var multiTagValues=field .map(function(){return $(this).val();}).get();