Removed noValidate and added formNoValidate to readme

This commit is contained in:
christianalfoni 2015-04-14 21:31:36 +02:00
parent 261d605c19
commit 1fb4461121
6 changed files with 20 additions and 7 deletions

View File

@ -43,6 +43,7 @@ A form input builder and validator for React JS
- [isPristine()](#ispristine)
- [isFormDisabled()](#isformdisabled)
- [validate](#validate)
- [formNoValidate](#formnovalidate)
- [Formsy.addValidationRule](#formsyaddvalidationrule)
- [Validators](#validators)
@ -590,6 +591,20 @@ React.render(<Formy.Form disabled={true}/>);
```
You can create custom validation inside a form element. The validate method defined will be run when you set new values to the form element. It will also be run when the form validates itself. This is an alternative to passing in validation rules as props.
#### <a name="formnovalidate">formNoValidate</a>
To avoid native validation behavior on inputs, use the React `formNoValidate` property.
```javascript
var MyInput = React.createClass({
mixins: [Formsy.Mixin],
render: function () {
return (
<div>
<input formNoValidate type="number"/>
</div>
);
}
});
### <a name="formsyaddvalidationrule">Formsy.addValidationRule(name, ruleFunc)</a>
An example:
```javascript

View File

@ -1,6 +1,6 @@
{
"name": "formsy-react",
"version": "0.12.0",
"version": "0.12.1",
"main": "src/main.js",
"dependencies": {
"react": "^0.13.1"

View File

@ -1,6 +1,6 @@
{
"name": "formsy-react",
"version": "0.12.0",
"version": "0.12.1",
"description": "A form input builder and validator for React JS",
"repository": {
"type": "git",

View File

@ -394,8 +394,7 @@ Formsy.Form = React.createClass({displayName: "Form",
return React.DOM.form({
onSubmit: this.submit,
className: this.props.className,
novalidate: 'novalidate' in this.props ? this.props.novalidate : true
className: this.props.className
},
this.traverseChildrenAndRegisterInputs(this.props.children)
);

File diff suppressed because one or more lines are too long

View File

@ -392,8 +392,7 @@ Formsy.Form = React.createClass({
return React.DOM.form({
onSubmit: this.submit,
className: this.props.className,
novalidate: 'novalidate' in this.props ? this.props.novalidate : true
className: this.props.className
},
this.traverseChildrenAndRegisterInputs(this.props.children)
);