heilhead / react-bootstrap-validation

Form validation for react-bootstrap
MIT License
136 stars 50 forks source link

Added "or" condition processing to validation parameters #53

Closed brewsoftware closed 8 years ago

brewsoftware commented 8 years ago

Added a new format for handling "or" conditions. Specifically this would be written as

<ValidatedInput id="profile-companyMail" name="companyMail" type="email" placeholder="Email" validate="isEmpty|isEmail" errorHelp="Incorrect Email" />

The above would validate a non-required email field.

brewsoftware commented 8 years ago

Note: This additionally has test reporting and working unit tests for the old and new behaviour. Note: I've also updated the test harness reporter to include code coverage. Note: Currently the conditions can either be all "and" or all "or" it does not support both.

TODO: Implement mixing of "or" and "and" condition logic. This would include something like...

(isEmpty|isEmail)&(isEmpty|isMobilePhone) backward compatability would keep the ',' seperator so the above could also be written as (isEmpty|isEmail),(isEmpty|isMobilePhone) or isEmpty|(isEmail|isMobilePhone)

brewsoftware commented 8 years ago

Please see issue #25 for a description of the original issue.

brewsoftware commented 8 years ago

This is covered by PR #54. A new single syntax to handle this and injecting parameters into the new Validator update.