URL not updated when submitting form with error

I am working on integrating Turbo with an existing application where I have a form on the front page - /. This form has the action attribute set to a different URL - /Contact/Create. When I submit the form with invalid data I’ve configured the server to return 422 instead of 200 - other than that I’ve made no changes.

When I submit with invalid data Turbo replaces the content with the new payload from the server, but the URL is not updated. This is a problem since the in the response from /Contact/Create does not have a specified action so the next submit goes to whatever page I’m on - in this case /.

Is there a way to get Turbo to update the URL also in this case?

I know this is a bit old by now. But adding data-turbo-action="advance" to the turbo-frame should change the url when the frame navigates.

1 Like