colinaut / alpinejs-plugin-simple-validate

Simple Alpine form validation plugin
105 stars 5 forks source link

Not hiding error on hidden fields when directly update #17

Closed g-rodigy closed 8 months ago

g-rodigy commented 1 year ago

As I understood from the code and my tests, if hidden input was updated programmatically, his validation state don't change. Need dispatch event blur/change or update munually with $validate.updateData.

From roadmap Maybe add x-value to allow easier updating of values dynamically it's about it?

colinaut commented 1 year ago

I'll look into either this or adding a MutationObserver to the value attribute. I can see that being really useful.

Just so ya know I may not have time to really dedicate to this till September. My free time is a bit crunched at the moment: work + some extra freelance + a friend's wedding I'm helping with + yard work.

colinaut commented 8 months ago

Fixed in Release 1.8: plugin has enhanced mutation observer which recognizes any javascript updates to the value attribute. Just use Alpine JS binding:value to set the value for the hidden input and the plugin will spot the change.