Expand my Community achievements bar.

AEM6.3 coral form with action javascript issue

Avatar

Level 8

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

Avatar

Level 5

Hi

srinivas channappa

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

Avatar

Level 8

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