Highlighted

Usage of Adaptive Form's File Upload and "getFileAttachmentsInfo"

fir89

08-01-2018

Currently building an adaptive form with textboxes and file upload as input.

After a button click, I would like to pass the files added into the File Upload component onto the Servlet via AJAX call.

I added the code below (into code editor) to send the path of the files within CRX into the servlet for further processing.

guideBridge.getFileAttachmentsInfo({

//this code will produce bugs

  success:function(list) {

     //ajax code to call servlet

}

});

Is using "getFileAttachmentsInfo" a good approach?

Replies

Highlighted

workflowuser

Employee

09-01-2018

Why not submit the form to REST endpoint ? In the payload you will have access to the attachments

Sending the file path is not recommended

Highlighted

fir89

09-01-2018

Thanks for the response. I am unfamiliar with AEM in general.

After page submission, the user will be directed to another page, which must hold the newly-generated unique ID of the previous submission. At this point, further inputs from the user will be required.

I noticed that I could redirect using the "Redirect URL/Path" config in AEM Forms. However, it does not seem that I could retrieve the response from the server and pass it to the next page. Therefore, I used the code above to process the data, retrieve the response and redirect manually.

Appreciate if you could guide me on your alternative. Thanks.