Closed whitebook closed 5 months ago
Hello @whitebook. I examined the reset function and realized u r right. Since she reset
function also resets the field's touched
and error
properties, there is no need to call validateField
afterwards. I'll publish an update to resolve that soon.
Thanks so much for the feedback...
Hello @whitebook Just published a release which resolves this issue. Again, thanks for reporting it https://github.com/kwameopareasiedu/vanjs-form/releases/tag/1.0.2 https://www.npmjs.com/package/vanjs-form
I see a small bug in your code.... seems when you call field.reset("field") if the validation mode is set to oninput your calling validateField on the field???
line 145: if (this.validationMode === "oninput") this.validateField(name); line 154: if (this.validationMode === "oninput") this.validateField(name);
I think in the validateField function you should see if the field is touched before validating because right now if the field is blank it shows the validation error. I am not even sure if on reset, we should be even calling validateField in the first place.
Thanks.