Refactor form initialization and data management in OpenForm component (#709)
* Refactor form initialization and data management in OpenForm component - Add resetAndFill method to Form class for more flexible form data handling - Update initForm method to use nextTick for better reactivity - Modify form initialization logic to reset and fill form data more consistently - Remove unnecessary computed import and add debug console.log * fix on fill again --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com>
This commit is contained in:
11
client/composables/lib/vForm/Form.js
vendored
11
client/composables/lib/vForm/Form.js
vendored
@@ -85,6 +85,17 @@ class Form {
|
||||
clearTimeout(this.recentlySuccessfulTimeoutId)
|
||||
}
|
||||
|
||||
resetAndFill(data = {}) {
|
||||
// Clear form state
|
||||
this.clear()
|
||||
|
||||
// Reset and update form data using the existing update method
|
||||
this.originalData = {}
|
||||
this.update(data)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
reset() {
|
||||
Object.keys(this)
|
||||
.filter((key) => !Form.ignore.includes(key))
|
||||
|
||||
Reference in New Issue
Block a user