Git Product home page Git Product logo

Comments (3)

gaperton avatar gaperton commented on July 29, 2024

Whenever input value is an empty string, and validation fails, it will add 'required' class to the input control. Thus, you will have an opportunity to mark it differently. With yellow, for example.

Or, don't draw the red border at all, just put an error message aside. In general, there is no point in not telling the user from the beginning which fields are required. That's the legacy of ancient HTML forms, where you just didn't have another opportunity cause server did the validation.

from nestedlink.

gaperton avatar gaperton commented on July 29, 2024

You could try to simulate this behavior with an additional component member which will turn off validation on first render (set it to true in componentDidMount). If this is the thing you really want to do. I wouldn't bother. Forms telling you which fields are required are great.

from nestedlink.

sealightPT avatar sealightPT commented on July 29, 2024

In many UI frameworks there's already a symbol (like a *) to represent the required fields (e.g. Office UI Fabric).
Displaying an error message before the user leaving the field is too "drastic" and not elegant.
What would be the best way to achieve this?

from nestedlink.

Related Issues (20)

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.