These three files show how to handle forms with (legacy) Turbolinks in your Rails app with the new Turbo Native adapters.
- The Rails controller renders the form partial with an
:unprocessable_entity
status when encountering a form validation error - The form is submitted via AJAX (
local: false
orremote: true
depending on your Rails version) - This is caught via the
ajax:error->form#onError
Stimulus action - The Stimulus controller replaces the form's contents with the server-sided rendered HTML
- The native app is informed when the redirect occurs on a succesful submission
They are part of a series I'm writing on Hybrid iOS apps with Turbo. I'm currently writing the article on forms and basic authentication.