Skip to content

Reset form after submit when transforming data #434

Answered by ajnsn
talelmishali asked this question in Help (Vue)
Discussion options

You must be logged in to vote

@talelmishali The form helper also has some of the Inertia event callbacks like onSuccess. This should work:

updateAirplaneInformation(id) {
    this.form
        .transform(data => ({
            ...data,
            remove_photos: this.removePhotos,
            images_path: this.imagesArray,
            img_path: this.featureImage,
        }))
        .post(route('airplanes.update', id), {
            preserveScroll: true,
            onSuccess: page => {
                // Clear your array here
            },
        });
},

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@talelmishali
Comment options

@adgower
Comment options

Answer selected by talelmishali
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants