Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to click on button in Adobe AEM form using javascript

Avatar

Level 1

I am new to AEM and wanted to test the form using javascript. In my AEM form there is button which clears all the fields value.

I need to click on that button using javascript.

I am not able to find any function for click or press in given document.

https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/pdfs/acrobatsdk_jsapiref.pdf

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@arvind12 Unfortunately not! Since, JS is served from the clienlib, you cannot inject it at runtime. However, you can use your favourite IDE to integrate it to AEM clientlib. 

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @arvind12 Assuming, you are using Custom/OOTB form component, JQuery/Java script code should be part of clientlib. 

Avatar

Community Advisor

Hi @arvind12 ,

In AEM - JS,CSS, etc. keeps under one folder that's called clientlib. To render your script based on some event you should have your JavaScript implemented in clientlib. For how to create clientlib please go through these below links.

  1. http://www.sgaemsolutions.com/2017/06/clientlibs-in-aem-63-part1.html
  2. http://www.sgaemsolutions.com/2017/06/clientlibs-in-aem63-part2_25.html

You can also visit this article to include JavaScript in different ways: https://sourcedcode.com/blog/aem/how-to-include-javascript-for-an-aem-website

Hope that helps!

Regards,

Santosh

Avatar

Level 1

Is there something which I can try/run with JavaScript Console within Adobe?

arvind12_0-1656356440063.png

 

Avatar

Correct answer by
Community Advisor

@arvind12 Unfortunately not! Since, JS is served from the clienlib, you cannot inject it at runtime. However, you can use your favourite IDE to integrate it to AEM clientlib.