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.

  • daisyKutter@lemmy.ml
    ·
    9 months ago

    Check this out:

    https://stackoverflow.com/questions/7002230/trigger-standard-html-validation-form-without-using-submit-button#17698873

    • Rick_C137@programming.dev
      hexagon
      ·
      edit-2
      9 months ago

      Thank @daisyKutter@lemmy.ml

      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 cent

      For 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..