You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My layout requires a button that links to an action with PATCH method inside another form. I can't see a way to do this anymore with Turbo. button_to inside an existing form generates a 2nd CSRF token which breaks on submit "Can't verify CSRF token authenticity". link_to tries GET instead.
Add the button_to outside the form and off canvas (class visually-hidden with bootstrap)
= button_to 'delete', method: :delete, data: { turbo_confirm: 'are you sure?' }, id: 'delete-btn'
Then where you want the delete button to appear add a label tag that points to the button:
= label_tag 'delete-btn', 'Delete', class: 'btn btn-secondary'
It's surprising the label connects with and submits the button even though it's inside a different form.
My layout requires a button that links to an action with PATCH method inside another form. I can't see a way to do this anymore with Turbo. button_to inside an existing form generates a 2nd CSRF token which breaks on submit "Can't verify CSRF token authenticity". link_to tries GET instead.
I've tried:
button_to 'Verify', verify_path, method: :patch
link_to 'Verify', verify_path, method: :patch
link_to 'Verify', verify_path, data: { turbo_method: :patch }
Prior discussion 1, 2, 3
The text was updated successfully, but these errors were encountered: