Hello Team,
I have created custom HTML button to call some external API within Laserfiche modern form designer as per below link.
https://answers.laserfiche.com/questions/210704/Clickable-custom-button-to-showhide-fields-in-Modern-Forms-designer
As soon as any response will coming from API, we needs to call submit button event. This is possible (check attached code.txt) in classic designer but how to achieve same from modern JavaScript custom code.
1. How to call submit event within custom HTML button click .
2. How to validate forms before call submit event from custom HTML button.
This is my entire flow
>>Custom button click event>> Forms validation completed>> API call>>Submit event>>Forms saved in repository.
My Overall objective is
We need to restrict (wait) submission until an API response comes, which is our overall objective.
Currently, we are using fetch for API requests and responses, as per the below link.
https://dmitripavlutin.com/javascript-fetch-async-await/
As soon as we receive any response from the API, we need to wait for form submission.
Currently, when we click on the submit button, the LF form is directly submitted without waiting for an API response, but we need to save it based on the "success" response within the API call. And that's why we are calling fetch API from custom button and once response will come based on that we need to call submit event.
Thanks,
Pratik