Expand my Community achievements bar.

Servlet trigger on dialog textfield in touchui

Avatar

Level 3

Hi,

I wanted a servlet trigger on textfield of dialog in touchui.

I tried with datasource node , but didn't work out.

Is datasource should be used in specific with servlet?

If so is there a way to trigger a servlet from textfield in touchui dialog.

Currently I am using aem6.4

Thanks in advance!!

2 Replies

Avatar

Level 4

You can use <granite:data & listeners to trigger servlet.

as mentioned below, you can set the class or identifier to invoke method when content loads.

<granite:data
   jcr:primaryType="nt:unstructured"
   dd-showhide-target=".show-hide-field"/>

JS.

the foundation-contentloaded will be triggered whenever dialog opens

(function (document, $, Coral) {

   "use strict";

  $(document).on("foundation-contentloaded", function (e) {

$(".class", e.target).each(function (i, element) {

   var target = $(element).data("data-fld-class");

   if (target) {

  Coral.commons.ready(element, function (component) {

// write you logic

}

});

})(document, Granite.$, Coral);

More details :

Listeners implementations in touch UI.

Adobe Experience Manager Help | Using Event Handlers in Adobe Experience Manager Touch UI Components

Thanks!

Avatar

Community Advisor

Hi,
What is your use case?
You can invoke servlet using Ajax request. for example on text field change, you can write jquery event listeners, which will be executing js code and invoking servlet.



Arun Patidar