@gregmsanderson puts it best in regards to validating a form submission:
What we'd need is for the 302 caused by the validation error to target the form element (and so not cause a full-page reload) but the 302 caused by a successful submit to use _self and so do a full page load.
So the new behavior added to _self works like this:
Any 3xx class status code redirecting to a different page will load the redirected URL in the browser window
Any 3xx class status code redirecting back to the current page will target my_form.
For developers who want to trigger a full-page reload no matter what the status code is, we've added a new _top target key word that behaves just like _self did before this PR.
This PR adds some additional support for form validation to the special
_self
target keyword and introduces the new_top
keyword.The discussion surrounding these changes is here: https://github.com/imacrayon/alpine-ajax/issues/79
@gregmsanderson puts it best in regards to validating a form submission:
So the new behavior added to
_self
works like this:my_form
.For developers who want to trigger a full-page reload no matter what the status code is, we've added a new
_top
target key word that behaves just like_self
did before this PR.Fixes #79