Skip to content
This repository has been archived by the owner on Dec 25, 2017. It is now read-only.

How to reset the "$validator1.modified" flag to unmodified? #136

Closed
hldgaofeng opened this issue Jan 16, 2016 · 3 comments
Closed

How to reset the "$validator1.modified" flag to unmodified? #136

hldgaofeng opened this issue Jan 16, 2016 · 3 comments

Comments

@hldgaofeng
Copy link

I use a form in a dialog, My form will used many times after it is created, and will not be destoryed.

How to reset the "$validator1.modified" flag to unmodified?

when user cancelling the dialog, I want to use the flag to detect is the form modified.

@kazupon
Copy link
Owner

kazupon commented Jan 16, 2016

See the https://github.com/vuejs/vue-validator#top-level-validation-properties

modified: if modified field exist even one in validate fields, return true, else false.

You can reset the modified of top level, when you reset all fields value.

Do you want to reset with API ?

@hldgaofeng
Copy link
Author

Thanks for your response!
Yes, I want a API to reset form validator's modified state.

Example:

// modify form field values.
form.field1 = value1;
form.field2 = value2;
...
form.fieldn = valuen;

// reset validator's modified flag to "false".
form.$validator1.reset(); // will reset all field's modified state to "false"!!

@kazupon
Copy link
Owner

kazupon commented Jan 18, 2016

Thanks for your example codes!
I understood your request.
I'll try to add reset API. 😸

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants