Skip to content

Allow turbo responses within frames to break out of the frame dependent on success/failureΒ #133

@simmerz

Description

@simmerz

My use case:

I have a form in a modal (don't judge me). I would like to submit the form, but there are validation errors with the submission, so I want to replace the form in the modal with one containing error messages.

Now I submit again, but this time I've fixed my validation issues and the response should redirect the entire page to a new url.

I'm using a <turbo-frame id="modal"> to contain the modal, and for the errors, <form data-turbo-frame="modal"> works brilliantly, but it would be great if I could determine different outcomes depending on the success of the submit.

I had some thoughts around whether adding other data-* attributes would work as a potential solution here. Eg data-turbo-frame-failure and data-turbo-frame-success might be used to direct the response at different targets depending on the result of the request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions