XavierGeerinck / Brewr-Site

Brewr IO site repository
http://brewr.io
GNU General Public License v3.0
132 stars 16 forks source link

Validate component #24

Open XavierGeerinck opened 9 years ago

XavierGeerinck commented 9 years ago
Should have: - type - placeholder - label - name - checkEmail (if true, check if email) - checkMinLength (specify a length) - checkMaxLength (specify a length) - checkRequired (if true, make sure it is not empty) - .... This way we can move the validate towards the component itself. Also add a state so that we can specify if it is valid or not. TODO: How can we check if the form is valid as a whole? (so on submission). Several solutions that I can think of: - Expose a function is validate in the validateinput to check every component - Create a custom form component that can do this by a function isValid? - Go through the states of the methods one by one manually? I think option 2 is the best and easiest since it removes all clutter and makes for easy submission