question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Validator: Field validated class

See original GitHub issue

Hi @icebob @dflock @cristijora,

I need a validated state (class) for my fields. I noticed in the source that there is a validationSuccessClass and by setting it with validationErrorClass, I can get a class that currently correspond to “no error”.

But “no error” and “validated” don’t have the same meaning. A field should have 3 states : “normal”, “error” and “validated”.

With validateAfterLoad: false, validateAfterChanged: false, I want my field to be “normal” until I trigger a validation. Then all fields are either “error” or “validated”.

With validateAfterLoad: false, validateAfterChanged: true, I want my field to be “normal” until I edit the field. Then this field is either “error” or “validated”.

With validateAfterLoad: true, validateAfterChanged: false, I want all my fields to be either “error” or “validated” after initial load. They keep their state until I trigger a validation.

With validateAfterLoad: true, validateAfterChanged: true, I want all my fields to be either “error” or “validated” after initial load. They keep their state until I edit the field.

With this behavior, it will be possible to add a checkmark or anything I want next to each “validated” field. It will allow my users to see their progress on the from.

TL:DR The goal is to have a class that mean “I have been through the validation process at least once and I have no error”

How can we achieve that ? I can do a PR if necessary but I wanted your opinion on the issue first.

Thank you !

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lionel-bijaouicommented, Nov 16, 2017

Hello @icebob , I’ve been extremely busy at work. I will try to catch up with the updates, and see if what I did at that moment is still working now. I have some catching up to do !

1reaction
lionel-bijaouicommented, Jul 13, 2017

Since this is used by all fields, I think we should at least namespace the internal properties with vfg or something like that. So with your proposition, that would create vfgTouched and vfgValid (or vfg_touched and vfg_valid). Is that ok for you @cristijora ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Validating one field in a class with class-validator
A workaround way is that you only pass one field and validate with 'skipMissingProperties' option. const exampleModel = new ExampleModel(); ...
Read more >
typestack/class-validator: Decorator-based property ... - GitHub
Allows use of decorator and non-decorator based validation. Internally uses validator.js to perform validation. Class-validator works on both browser and ...
Read more >
Validation · Bootstrap v5.0
Provide valuable, actionable feedback to your users with HTML5 form validation, via browser default behaviors or custom styles and JavaScript.
Read more >
E Sample Validation Class
This validation class must implement the com.thortech.xl.schedule.tasks.FieldsValidation interface and the validate method. The following is a sample validation ...
Read more >
Validators - pydantic
On class creation, validators are checked to confirm that the fields they specify actually exist on the model. Occasionally however this is undesirable:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found