Validator component: Custom validation #3522
Replies: 3 comments 3 replies
-
Thanks. Let me know if you have a question. |
Beta Was this translation helpful? Give feedback.
-
I wouldnt mind seeing a couple custom classes to force a validity class. Something like 'validator-valid' and 'validator-invalid' would be really helpful when using a third party form validation library in conjunction with a JS framework |
Beta Was this translation helpful? Give feedback.
-
@atollk Are you thinking of something like the html attribute |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I love the idea of the new Validator component (https://v5.daisyui.com/components/validator/).
What is missing for me is the option to have more control over the validation error, i.e. support for custom validation logic that goes beyond standard HTML.
I imagine it could look something like a new CSS class being added: "validator-error", which the daisyUI user can conditionally apply to their Validator element via JS. Basically, the current styling of the Validator would need to change so that it either reacts to :user-invalid or .validator-error.
I have been trying to get something working with
setCustomValidity
to manually set the:user-invalid
pseudo-clsas but calling that function inonfocusout
seems to be problematic w.r.t. order of execution.Unless I am missing something, this change is so small that I could probably create a PR for it.
Beta Was this translation helpful? Give feedback.
All reactions