Skip to content
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

Add custom validation pattern to the docs #26

Open
gaperton opened this issue Jul 7, 2017 · 2 comments
Open

Add custom validation pattern to the docs #26

gaperton opened this issue Jul 7, 2017 · 2 comments

Comments

@gaperton
Copy link

gaperton commented Jul 7, 2017

The pattern is to override component.linkAll().

  • Call linkAll of the base class to produce the relevant links.
  • Add custom validation checks.
  • If needed, compute the validationError and add it to the cache object.
  • return cache object.

It's damn cool pattern which deserves to be reflected in tutorials.

@richard-engineering
Copy link

richard-engineering commented Jul 13, 2017

  1. I don't use the validation in valuelink, instead using validate.js. From a user standpoint I think the built in validation is less feature rich than validate.js and maybe overreaching in scope/scale of this library. Just comments in case you are wondering where to put development energy. Now this may be due to lack of docs explaining why I should use the built in validation instead of validate.js.
  2. Regarding the convenience function that returns a link to everything in the state: when using valuelink at work I have been enforcing a naming convention that all variables that are link objects end with 'Link' in the name. The convenience function that returns all the links doesn't do so. Thus I don't find it too useful.
  3. Imo more important to the docs is to go over how to modify multiple parts of the state at the same time in various situations. I found this is a common question from coworkers. I looked at the source code recently to figure this out and now know the correct answer.

@gaperton
Copy link
Author

Well, quite contrary, I believe that the links validation mechanics is the feature which makes this library truly worthy. :) This is the major reason this lib was developed and being used by ReactMVx, which powers Volicon/Verizon product lineup.

There's the article about the validation with links here.

https://medium.com/@gaperton/react-forms-with-value-links-part-2-validation-9d1ba78f8e49#.nllbm4cr7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants