I am having two pages and calling an API on click event of first page's continue button. For example API takes 50 secs to return the response and need to stay on first page until API returning response. How to prevent navigation in this case?. Kindly help to assists on this. Thanks.
You can place a validation rule on the first page that will only return true when your API call has received a successful response.
Add a data field to your form, and set its value according to the success of your API response. You can use that as a flag in the page validation rule. If the flag is false, return an error message string from the validation rule.
Using the inbuilt mechanisms for validation also means your validation error messages will be displayed in the form for you.