Inertia Form `isDirty` attribute not there
See original GitHub issueVersions:
@inertiajs/inertia
version: 0.8.7@inertiajs/inertia-vue
version: 0.5.12
Describe the problem:
I am using the inertia form helper:
data() {
return {
form: this.$inertia.form({
formData: this.object.fillerData,
anImage: null,
})
}
}
the form is populated with already existing data from a prop passed to the page because this page is where you update the db records
it also has a file upload section in the form but initially that is just loaded in as a null value
in the vue dev tools the form comes up with the following attributes:
...
errors:Object (empty)
get:ƒ get(e, r)
hasErrors:false
patch:ƒ patch(e, r)
post:ƒ post(e, r)
...
as you can see the form has no isDirty
property which is what i would like to use to ensure a change to the form data has occurred before allowing the user to submit the new data to the controller method which will handle it, like so:
<SubmitFormButton v-if="form.isDirty" @click="send" :loading='form.processing' type='submit'>Update {{prop.propName}}</SubmitFormButton>
to reproduce try making a form with pre-filled data from a prop and a null value form section and then see if the form has the isDirty
property
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Forms
When a form has been successfully submitted, the wasSuccessful property will be true . In addition to this, there is also a recentlySuccessful...
Read more >isDirty is true after submitting and reloading InertiaJS page
When the page reloads, it doesn't seem to reset the Inertia form isDirty state from true to false even when I manually refresh...
Read more >useForm - setValue
Whether to compute if your entire form is dirty or not against your defaultValues (subscribed to isDirty ). This option will update dirtyFields...
Read more >Inertia.js forms, modals, and SSR - Jonathan Reinink - YouTube
Inertia.js forms, modals, and SSR - Jonathan Reinink - Laracon Online Summer 2021Jobs in Laravelhttps://larajobs.
Read more >2:59 PM · May 7, 2021
form helper this morning. This provides a really easy way to show a "there are unsaved form changes" message. Got it working in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In case you guys didn’t know, there is no other project which gives as good support as Inertia, at least that I know of
@RobertBoes @reinink Thank you so very much
The
isDirty
helper was added in inertia-vue@0.6.0.You’ll need to update before you can use this. 👍