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

AEM6.3 coral form with action javascript issue

srinivas_chann1
Level 7
Level 7

Hi ,

I am using AEM6.3 and using sling resource as granite/ui/components/coral/foundation/form. I need to have the java-script getting called to perform ajax call to servlet. But on page render the action is showing empty and hence cannot call java-script on submit . Please let me know o resolve it.

Have the below code

<form1

              granite:id="tag-edit-form"

              jcr:primaryType="nt:unstructured"

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

             action="javascript:onsubmitprocess()"

              foundationForm="{Boolean}true"

              maximized="{Boolean}true"

              method="post"

              novalidate="{Boolean}true"

              style="vertical">

Note:- I could have called the servlet directly in action using something like /bin/servletcall  .But the problem i have is i need to show a dialog success on the page after successful  operation of servlet  hence thinking that using ajax will be better option.

Not sure how could i achieve it by directly calling servlet  in action

Thanks

3 Replies
Umesh_Sondhi
Community Advisor
Community Advisor

Hi

srinivas channappa

You are calling servlet from forms action instead you have to call servlet on the click of submit .

srinivas_chann1
Level 7
Level 7

Hi,

I would want to show a dialog on servlet response back to user like success or failure with custom message.Hence want to use javascript on action for ajax but action is not supporting action="javascript:onsubmitprocess()"

Could you please provide any sample code which i could use with

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

Thanks