Skip to content

Add custom validation pattern to the docs #26

Open

Description

@gaperton

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.

Activity

  1. richard-engineering commented on Jul 13, 2017

    @richard-engineering
    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.
  2. gaperton commented on Oct 20, 2017

    @gaperton
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions