Submissions send requests and Fore gives you a lot of options to deal with the response to
that requests by setting the replace
attribute.
What to do with the response data a server might send us back?
The replace
attribute allows several ways of dealing with response data.
Just sends the data but ignores the response
You won't notice a difference unless you're using a developer tool to inspect the network requests. However there will be a toast message when it succeeds.
Sends the data and replaces the default instance with response
Sends the data and replaces the instance with id='replaced'
Replaces the whole viewport (window) with response. However that will not change the URL shown in the browser location bar.
Replaces some HTML at target position. target is a CSS selector pointing to the wanted element.
expects a URL returned as simple string and redirect to that.
If something goes wrong the 'submit-error' event will fire.
If something goes wrong the 'submit-error' event and set status code and message