react-form-validator-component
Advanced tools
Comparing version 1.6.4 to 1.6.5
{ | ||
"name": "react-form-validator-component", | ||
"version": "1.6.4", | ||
"version": "1.6.5", | ||
"main": "build/lib/index.js", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:JDLT-Ltd/react-form-validator-component.git", |
@@ -33,14 +33,14 @@ import React from 'react' | ||
fields = { | ||
// emailAddresses: { | ||
// name: 'emailAddresses', | ||
// rules: ['isEmailArray'], | ||
// required: true, | ||
// label: 'Email addresses' | ||
// }, | ||
// something: { | ||
// name: 'something', | ||
// rules: ['isPhoneNumber'], | ||
// required: 'test', | ||
// label: 'Something' | ||
// }, | ||
emailAddresses: { | ||
name: 'emailAddresses', | ||
rules: ['isEmailArray'], | ||
required: 'test', | ||
label: 'Email addresses' | ||
}, | ||
something: { | ||
name: 'something', | ||
rules: ['isPhoneNumber'], | ||
required: 'test', | ||
label: 'Something' | ||
} | ||
// number: { | ||
@@ -57,10 +57,10 @@ // name: 'number', | ||
// label: 'name' | ||
// }, | ||
sources: { | ||
rules: [], | ||
name: 'sources', | ||
required: true, | ||
label: 'sources', | ||
defaultValue: [options[0].value] | ||
} | ||
// // }, | ||
// sources: { | ||
// rules: [], | ||
// name: 'sources', | ||
// required: true, | ||
// label: 'sources', | ||
// defaultValue: [options[0].value] | ||
// } | ||
} | ||
@@ -84,17 +84,21 @@ | ||
<Validator fields={this.fields} parent={this} validateOnLoad> | ||
{({ isFormValid, onChange }) => { | ||
{({ isFormValid, isFieldValid, onChange, errors }) => { | ||
return ( | ||
<Form> | ||
<Form.Field | ||
name="sources" | ||
label="Source / Source Group" | ||
options={options} | ||
defaultValue={[1]} | ||
fluid | ||
multiple | ||
selection | ||
search | ||
onChange={onChange} | ||
control={Dropdown} | ||
/> | ||
<Form.Field> | ||
<label>Your Emails</label> | ||
<input name="emailAddresses" onChange={onChange} /> | ||
{this.renderErrors(errors.emailAddresses)} | ||
</Form.Field> | ||
<Button onClick={() => alert('sure is')} disabled={!isFieldValid.emailAddresses}> | ||
Thats an Email! | ||
</Button> | ||
<Form.Field> | ||
<label>Something</label> | ||
<input name="something" onChange={onChange} /> | ||
{this.renderErrors(errors.something)} | ||
</Form.Field> | ||
<Button onClick={() => alert('is it?')} disabled={!isFieldValid.something}> | ||
Its not nothing | ||
</Button> | ||
{<span>Form is {isFormValid ? 'valid' : 'not valid'}</span>} | ||
@@ -101,0 +105,0 @@ <hr /> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
325437
724