Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

San103
San103

Posted on

Need help Inertia Vue Developer, this.$inertia.form

Image description

Good day programmers. I just wanna ask for help about my inertia vue 3 project little bit of typeScript. I have a create and update button with modal, now I made just one form(modal) for both of them and I use this.$inertia.form for storing and retrieving data, now my problem is that I cant seem to reset the form whenever I close the modal when I go first in editModal(display data) to createModal()- It still displayed the data in createModal() form, I tried the this.form.reset() in closeModal function but doesnt work. I know its kinda basic for you guys this kinda problem but I appreciate your answer Thanks.

data(){    form: this.$inertia.form({                firstName: '',                lastName: '',                gender: 'Male',            })}methods:{       editModal(rider: Rider) {            this.form = this.$inertia.form(rider);            //when assigning this.form to rider object, it cannot         be reset!            this.showModal = true;            this.editMode = true;        },        createModal(){            this.showModal = true;        },        closeModal() {            this.showModal = false;            this.editMode = false;            this.form.reset();        },}
Enter fullscreen modeExit fullscreen mode

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Sorry I am just a Beginner who is eager learn
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp