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

Flexibility with Validation Input Groups #127

Open
ninjasort opened this issue Jan 11, 2016 · 1 comment
Open

Flexibility with Validation Input Groups #127

ninjasort opened this issue Jan 11, 2016 · 1 comment

Comments

@ninjasort
Copy link
Contributor

Currently, validation for forms is not documented and does not seem to be flexible for a regular text input. For example, <EmailInputGroup /> seems to be too specific and tied to an email input. Would it make more sense to simply apply validation to the form elements as props. In angular for example, you get a scoped form object that uses children form elements based on their name properties. For example a form with name="someForm" with an input with name="email" would be inherited and referenced as someForm.email for validation attributes (pristine, dirty, invalid, valid).

Would it make sense to pass the validation state of the FormField in via this.props. For example:

<FormField validity={this.props.validity}>
</FormField>

This would allow the FormField to specify a childContextType and pass the validity down to whatever child existed under the FormField. Then both the FormField and the child component (FormInput, Checkbox) would render themselves based on the validation passed in. When the FormInput, Checkbox changes it's validation, the onChange would trigger passing the current validity along as well. Upon validation in the developers callback, he could pass down the new validation.

@jossmac
Copy link
Member

jossmac commented Jan 11, 2016

We're on the same page :)

Please see my comment on #46

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