Giter VIP home page Giter VIP logo

Comments (4)

justin-schroeder avatar justin-schroeder commented on May 14, 2024 2

@antemarkic Thanks for the suggestion. We did this in vue formulate by adding a data attribute data-is-valid, and data-has-error this is nice because it leaves the class system free/clear for people who want to write their own class solutions. We could pretty easily re-create that same tooling here in FormKit.

Let’s add it to the roadmap.

from formkit.

justin-schroeder avatar justin-schroeder commented on May 14, 2024

@antemarkic this is release-ready and will be published with 1.0.0-beta.3. Here's an example of it running on beta.3:

https://formkit.link/cb85162e120c9de18e0298dbd8ca849e

Basic rules:

data-complete

True when these conditions are met:

Either:

  • The input has validation rules
  • The validation rules are all passing
  • There are no errors on the input
    Or:
  • The input has no validation rules
  • The input has no errors
  • The input is dirty and has a value

This is not intended to be used on forms/groups/lists but instead on individual inputs. Imagine placing a green checkbox next to each input when the user filled it out correctly β€” thats what these are for.

data-invalid

Added when the input has failing validation messages and those messages are being displayed !context.state.valid && context.state.validationVisible

data-errors

Added whenever explicitly set errors are on the input, either via a parent (like setErrors() from the form), or directly via the :errors prop.

from formkit.

aegorx avatar aegorx commented on May 14, 2024

Hi, @justin-schroeder.
While adding built-in attributes is a nice feature, If message uses the transition tag, the style changes ugly, is there any way to add a custom class?

I'm sorry, that's what I wanted to say yesterday. Now that I've handled the transition hook manually, it would be nice to have a built-in API

from formkit.

justin-schroeder avatar justin-schroeder commented on May 14, 2024

You can modify this behavior on your own β€” although I'm still not exactly sure what behavior you're looking to modify. Perhaps you could make a playground at https://formkit.com/playground with an example of the transition you are attempting and what you are wanting to achieve and then I can assist from there. Thanks @aegorx!

from formkit.

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.