Update README.md
This commit is contained in:
parent
54a857638a
commit
01e6b36a36
22
README.md
22
README.md
|
|
@ -3,8 +3,7 @@ formsy-react
|
|||
|
||||
A form input builder and validator for React JS
|
||||
|
||||
## Running with React 0.13.x
|
||||
In development you will get a warning about Formsy overriding `props`. This is due to a change in the React API. A new solution has been developed for next Formsy release, though it will not be available until React 0.14.0 is ready. So please just ignore the warning for now and when React 0.14.0 is here, they will be gone!
|
||||
## From version 0.12.0 Formsy only supports React 0.13.1 and up
|
||||
|
||||
[Read more about Formsy release v1.0.0](https://github.com/christianalfoni/formsy-react/issues/83)
|
||||
|
||||
|
|
@ -25,6 +24,7 @@ In development you will get a warning about Formsy overriding `props`. This is d
|
|||
- [onValidSubmit()](#onvalidsubmit)
|
||||
- [onInvalidSubmit()](#onvinalidsubmit)
|
||||
- [onChange()](#onchange)
|
||||
- [novalidate](#novalidate)
|
||||
- [Formsy.Mixin](#formsymixin)
|
||||
- [name](#name)
|
||||
- [value](#value)
|
||||
|
|
@ -223,7 +223,7 @@ var Form = React.createClass({
|
|||
|
||||
#### <a name="onsubmit">onSubmit(data, resetForm, invalidateForm)</a>
|
||||
```html
|
||||
<Formsy.Form url="/users" onSubmit={this.showFormLoader}></Formsy.Form>
|
||||
<Formsy.Form onSubmit={this.showFormLoader}></Formsy.Form>
|
||||
```
|
||||
Takes a function to run when the submit button has been clicked.
|
||||
|
||||
|
|
@ -231,34 +231,40 @@ The first argument is the data of the form. The second argument will reset the f
|
|||
|
||||
#### <a name="onvalid">onValid()</a>
|
||||
```html
|
||||
<Formsy.Form url="/users" onValid={this.enableSubmitButton}></Formsy.Form>
|
||||
<Formsy.Form onValid={this.enableSubmitButton}></Formsy.Form>
|
||||
```
|
||||
Whenever the form becomes valid the "onValid" handler is called. Use it to change state of buttons or whatever your heart desires.
|
||||
|
||||
#### <a name="oninvalid">onInvalid()</a>
|
||||
```html
|
||||
<Formsy.Form url="/users" onInvalid={this.disableSubmitButton}></Formsy.Form>
|
||||
<Formsy.FormonInvalid={this.disableSubmitButton}></Formsy.Form>
|
||||
```
|
||||
Whenever the form becomes invalid the "onInvalid" handler is called. Use it to for example revert "onValid" state.
|
||||
|
||||
#### <a name="onvalidsubmit">onValidSubmit(model, resetForm, invalidateForm)</a>
|
||||
```html
|
||||
<Formsy.Form url="/users" onValidSubmit={this.sendToServer}></Formsy.Form>
|
||||
<Formsy.Form onValidSubmit={this.sendToServer}></Formsy.Form>
|
||||
```
|
||||
Triggers when form is submitted with a valid state. The arguments are the same as on `onSubmit`.
|
||||
|
||||
#### <a name="oninvalidsubmit">onInvalidSubmit(model, resetForm, invalidateForm)</a>
|
||||
```html
|
||||
<Formsy.Form url="/users" onInvalidSubmit={this.notifyFormError}></Formsy.Form>
|
||||
<Formsy.Form onInvalidSubmit={this.notifyFormError}></Formsy.Form>
|
||||
```
|
||||
Triggers when form is submitted with an invalid state. The arguments are the same as on `onSubmit`.
|
||||
|
||||
#### <a name="onchange">onChange(currentValues)</a>
|
||||
```html
|
||||
<Formsy.Form url="/users" onChange={this.saveCurrentValuesToLocalStorage}></Formsy.Form>
|
||||
<Formsy.Form onChange={this.saveCurrentValuesToLocalStorage}></Formsy.Form>
|
||||
```
|
||||
"onChange" triggers when setValue is called on your form elements. It is also triggered when dynamic form elements have been added to the form. The "currentValues" is an object where the key is the name of the input and the value is the current value.
|
||||
|
||||
#### <a name="novalidate">novalidate</a>
|
||||
By default Formsy will set the "novalidate" attribute on the form, ignoring native validations. You can turn this off with:
|
||||
```html
|
||||
<Formsy.Form novalidate={false}></Formsy.Form>
|
||||
```
|
||||
|
||||
### <a name="formsymixin">Formsy.Mixin</a>
|
||||
|
||||
#### <a name="name">name</a>
|
||||
|
|
|
|||
Loading…
Reference in New Issue