Skip to content

Commit

Permalink
Update validationWiring.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrelogan committed Mar 12, 2016
1 parent 9f189c7 commit 7b086bd
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/validationWiring.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ this is *not* a validation library per se, but it *wires up* validation, which i

for reusable validation logic, in addition to [react-formstate-validation](https://github.com/dtrelogan/react-formstate-validation), reference [validator](https://www.npmjs.com/package/validator).

also, [joi](https://www.npmjs.com/package/joi) has an awesome api, but it's not meant for client-side validation and adds about a megabyte to your bundle.
([joi](https://www.npmjs.com/package/joi) has an awesome api, but it's not meant for client-side validation and adds about a megabyte to your bundle.)

### basic usage

Expand Down Expand Up @@ -54,7 +54,7 @@ validateUsername(username) {

required validation is called first, and if that passes, the autowired validateUsername function will be called.

### tailoring a message
### tailor a message

```jsx
<Input required='Please provide a username' />
Expand Down Expand Up @@ -175,24 +175,24 @@ you can optionally tailor messages in the jsx:
/>
```

msgs is an abbreviation for validationMessages. this also works:
'msgs' is an abbreviation for 'validationMessages'. this also works:

```jsx
<Input validate='noSpaces' msgs='no spaces please' />
```

note you can tailor selectively:
note you can selectively tailor:

```jsx
<Input
validate={['noSpaces',['minLength',4]]}
validationMessages={[null, 'At least 4 characters please']}
msgs={[null, 'At least 4 characters please']}
/>
```

### fsValidate

a registered validation also receives the following syntax, accessed through 'fsValidate':
a registered validation also receives the following syntax, accessible through 'fsValidate':

```jsx
<Input
Expand Down Expand Up @@ -228,6 +228,8 @@ fsValidatePasswordConfirmation(fsv, context) {

you may have noticed that fsValidate functions can return either an 'fsv' object or a string.

enjoy!

### asynchronous validation

all validation functions documented in this section are intended to be callbacks for the framework generated event handler. they should be *synchronous*. asynchronous validation should instead override the event handler. an example is provided [here](/docs/asyncExample.md)

0 comments on commit 7b086bd

Please sign in to comment.