You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am experiencing some weird behaviour when updating an existing record:
Once the updated information has been persisted in the database, the onsuccess() method in axios's then() method is fired. In this function, the this.reset() function is always called, which restores the form to its state of before the update; thus when it contained the old information that has just been changed/updated. There is currently no way to opt-out of this form reset, but would it be possible to make this? Maybe leave this action to the user to call it in the promise that is returned to the form?
The text was updated successfully, but these errors were encountered:
I had the same issue today, and I ended up modifying the Form.js file in a few places. Without claiming this is the best way to go about this, I believe it sorts out what you described.
Modify the submit method to also pass the requestType on success:
/**
* Reset the originalData fields. The is needed after an update ('put' or 'patch' request)
*/
resetOriginalData() {
for (let field in this.originalData) {
this.originalData[field] = this[field];
}
this.errors.clear();
}
The reset method remains unchanged:
/**
* Reset the form fields.
*/
reset() {
for (let field in this.originalData) {
this[field] = this.originalData[field];
}
this.errors.clear();
}
I am experiencing some weird behaviour when updating an existing record:
Once the updated information has been persisted in the database, the onsuccess() method in axios's then() method is fired. In this function, the this.reset() function is always called, which restores the form to its state of before the update; thus when it contained the old information that has just been changed/updated. There is currently no way to opt-out of this form reset, but would it be possible to make this? Maybe leave this action to the user to call it in the promise that is returned to the form?
The text was updated successfully, but these errors were encountered: