-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid state for the new form #5
Comments
Sure you can. Like this:
|
But I don't see any advantage in not telling the user from the beginning which fields are required. What I would probably done if our QA would be bothered, is introducing different styles for error messages. .check( x => x, { type : 'required', name : 'Name' }) Then, I would modify Input controls so they will style different error types differently. And this 'field required' message wouldn't look that scary. |
To do it in better way you need something more advanced than plain React state. Problem here is that checks are not attached to the state, they are inlined in render(). Which is okay for many cases, but you cannot run checks outside of If you use models instead of the React state, you can. Cause checks will be attached to the model attributes, and your can validate model as a whole or by parts at any time you want. Which allows for variety of different validation strategies. That's what we're doing. We are not using React state in production at all. And these links are attached to the models, so you can be quite flexible in approach to validation. |
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. Changes are now in 'develop' branch, will be released soon. Thanks for the bug, it's was really the good point. |
It's pretty uncommon to see error messages on empty new form.
Ex in user list example, as soon as Add user button clicked.
Is there any way in valuelink library to postpone the validation till user navigates out of the field, or press submit button?
The text was updated successfully, but these errors were encountered: