inertiajs / inertia-laravel

The Laravel adapter for Inertia.js.
https://inertiajs.com
MIT License
2.03k stars 227 forks source link

redirect back but not clearing form and state #513

Closed DeviJv closed 1 year ago

DeviJv commented 1 year ago

how to redirect back with reseting form and clear the usestate

paulmax-os commented 1 year ago

Assuming you're using Vue:

const form = useForm({
    // your v-models / inputs
});

const submitForm = () => {
    form.post('/profile', {
        onSuccess: () => form.reset('password'),
    });
}

There are a couple of form helpers available, it's worth having a look: https://inertiajs.com/forms#form-helper

jessarcher commented 1 year ago

Hi there,

Thanks for reporting the problem you are encountering, but it looks like this is a question that may be better suited for a support channel. We only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use the functionality provided by this repository, you can try one of the following channels:

However, this issue will not be locked, and everyone is free to discuss solutions to your problem!