Coder Social home page Coder Social logo

form-validation-tips's Introduction

Form validation repo

My experiments based on the cloud4 series of articles:

Notes:

  • includes browswer build in constraint validation
  • includes @supports to make :user-invalid/:user-valid progressive enhancement for chrome (chrome doesn't support them (on 2023-09-09))
  • no_js/js cases: <body data-js-enabled='false'> approach. If js is enabled, :user-valid/:user-invalid and :valid/:invalid are ignored
  • novalidate form attribute to disable browser build in constraint validation (disables validation and error messages. But :valid/:invalid styling is still applied 🤷🏼‍♂️)
  • real-time and late validation but late validation is generally always better (Live validation UX)
  • includes :has pseudoclass test
@supports (selector(:has(input))) {
  .field-wrapper:has(input:required) label:after {
    content: "*";
  }
}
  • custom “error” element (a paragraph tag after each .js-validate input).
    • The “error” element should have a hidden attribute so it is not displayed by default
    • The input should have an aria-describedby attribute with the ID of the “error” element so assistive technologies can convey validation feedback to users when the input is in focus.
    • errors gets a messages from Constraint Validation API (localized browser-specific error message)

form-validation-tips's People

Contributors

serjilyashenko avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.