Category: JavaScript
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Geting error while connceting the worldflow with button

Issue

I am trying to validate an input field when the user hits a button without entering any details. I have created a workflow for an error message, but it is not working correctly. I need to show an error message if the user number is invalid and only move to the next page if it is valid. Can I validate the input using API calls and query instead of writing a JsObject code? Also, how to calculate the API call in and out time, and can I upload an image from local storage rather than a URL?

Resolution

The solution involves using a JsObject to validate input fields before allowing the user to proceed to the next page or execute an API call. This can be set to run onClick of a button. The validation code can be customized to check for specific conditions such as valid user number.

To calculate API call in and out time, you can use the in-built debugging tools in Appsmith, or write code to measure the time between making the API call and receiving a response.

For uploading images from local storage, you can use a file picker widget in Appsmith to select the image file and store it in a variable. This variable can then be used to reference the image in an upload API call.