Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Adding two HTTP Submit Buttons to a single XDP form (OSGi)

Avatar

Level 2

Hi All,

We have a use case where we need to add 'Print' and 'Submit' buttons to an HTML5 form. We are calling a servlet and adding that servlet from the XDP file properties. This servlet will call two different methods based on the click event. For example, if a user clicks on 'Print,' it will call the same servlet with Print method and a separate method for submission.

First of all, could you please let me know if we can add two HTTP Submit Buttons to a single XDP form? If yes, then how can we call the same servlet? Can we call it through an AJAX call?

Alternatively, you can also guide me on how to achieve this use case with better approach.

Best regards

Nilesh

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

One approach will be to expose the Post method servlet as RESTful API, using a swagger file to create data source configuration and create a form data model based on it and integrate it with your form.

 

Take a submit button and Configure the Adaptive Form container submit action as  Submit using the Form Data Model.

Based on passing the data to the post method, you can write your logic for the print/submit button in the servlet.

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

One approach will be to expose the Post method servlet as RESTful API, using a swagger file to create data source configuration and create a form data model based on it and integrate it with your form.

 

Take a submit button and Configure the Adaptive Form container submit action as  Submit using the Form Data Model.

Based on passing the data to the post method, you can write your logic for the print/submit button in the servlet.

Avatar

Administrator

@nileshpb Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni