this post was submitted on 27 Jan 2024
7 points (100.0% liked)

JavaScript

1975 readers
1 users here now

founded 1 year ago
MODERATORS
7
submitted 9 months ago* (last edited 8 months ago) by Rick_C137 to c/javascript
 

~~ cross-posted from: https://programming.dev/post/9179830 ~~

Hi,

I'm loading some content with XHR (aka Ajax) the loaded input elements that have a invalid value assigned are not checked trough the validation process.

so the CSS styling with :invalid is for example not working etc..

is there a way to force the validation process on those elements ?

edit: Browser is Firefox

Thanks.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 9 months ago (1 children)
[–] Rick_C137 1 points 9 months ago* (last edited 9 months ago) (1 children)

Thank @[email protected]

it's look like that that code only verify the form when submitting.. I need to check the validity when the element has been loaded.

btw checkValidity() do not solve this issue as it return True when the length is longer than maxlength ! O_o I guess this is were is lying the "bug"

My two centFor me this is a huge flaw ! I don't understand how we (dev) are we still developing on "standard" that are so f*ck-up..

[–] [email protected] 1 points 9 months ago

There are several proposed workarounds there, like

https://caniuse.com/constraint-validation