Introduction
Simply Formly provides a simple yet flexible way to handle form submissions without requiring complex backend code. By default, after processing a submission, Simply Formly displays a built-in template page to indicate success or error.
However, for projects that require more control over user experience, Simply Formly offers callback URLs that can redirect users to your own custom pages after a form submission succeeds or fails.
Callback URLs
1. Success Callback
The callback_success
field allows you to define a URL where users will be redirected when a form submission is successful.
- If this field is left blank, Simply Formly will show its default success template.
- If a URL is provided, Simply Formly will issue a
GET
request redirect to that URL instead.
2. Error Callback
Similarly, the callback_error
field lets you specify where to redirect users when something goes wrong with the form submission.
- If this field is left blank, Simply Formly will show its default error template.
- If set, the user will be redirected to the specified URL.
Optional Usage
Both callback_success
and callback_error
are optional. This means you can:
- Keep them empty for the default behavior.
- Set only one of them (e.g., define a custom success page but use the built-in error page).
- Set both to take full control of the redirection flow.
Tricks and Tips
A useful trick when defining callback URLs is to use query parameters to pass status information into your own application.
For example:
https://www.my-awsome-domain.com/form?status=success
https://www.my-awsome-domain.com/form?status=error
This allows your frontend to apply custom logic based on the result, such as showing a tailored message, tracking analytics events, or updating UI elements dynamically.
Conclusion
Callback URLs provide flexibility for developers who want to control what users see after submitting a form. You can safely leave these fields empty and rely on Simply Formly’s built-in templates, or configure your own redirections for a fully customized experience.
By combining callback URLs with query parameters, you can unlock advanced behaviors while keeping the integration simple and user-friendly.