Hi. I’ve tried to use the form state options, and I’ve tried to use the “action after submit” and “action after error” options and none of these things seems to work when a form is submitted.
Currently, I can submit a form, and it updates the database, but I am unable to determine how to notify the user of success/error.
What is the recommended way to handle success/error on form submission so that a user can be informed if the request was successful or not?
You can do this with conditional display. For example, hiding your form container after a successful form submission, and displaying a success message instead.
In the example below, we don’t hide the form container after the form submission because the user might want to update another record, but we want to display a success or error message when they submit the form.
So we created:
two containers: one with the success message, one with the error message, and
two boolean variables with a default value of false which we change in the workflow to trigger the display of the correct message:
I’m also experiencing some issues where the submit button doesn’t actually trigger the form container workflows. Should I just be setting up workflows on button press instead?
If you need to submit a form, I would have the Workflow on the Form Container with an “On Submit” trigger.
If you’ve done that and you’re experiencing an issue, could you start a new thread with a short loom video explaining how you set up the form, the workflow, and what you’re trying to do?
Ok, I actually just realized that an issue was happening with this form where an “Internal Error” was preventing API calls from going through. I tried toggling “Make this request through a server” on and off and it worked! I don’t have an explanation, but figured I’d share
Ah ok great, glad you found the solution! And thanks for taking the time to share
It means you were trying to make a client-side API call to an API that only access server-side requests.
By default, being a frontend builder, WeWeb will make client-side API calls. Because many REST APIs only accept server-side calls, we built a feature that allows you to make server-side calls if you need to.
However, if you didn’t want your call to go through a server of ours, you could also contact the API admin to allow the “weweb.io” domain to make client-side requests.