react-form-validator-component
Advanced tools
Comparing version 1.7.13 to 1.7.14
{ | ||
"name": "react-form-validator-component", | ||
"version": "1.7.13", | ||
"version": "1.7.14", | ||
"main": "build/lib/index.js", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:JDLT-Ltd/react-form-validator-component.git", |
import React from 'react' | ||
import reactDOM from 'react-dom' | ||
import { Form, Header, Label, Container, Button } from 'semantic-ui-react' | ||
import { Form, Header, Label, Container, Button, Modal } from 'semantic-ui-react' | ||
@@ -86,44 +86,48 @@ import { Validator } from '../lib/index' | ||
return ( | ||
<Form> | ||
<Form.Field | ||
control={'input'} | ||
label="Your emails" | ||
onChange={onChange} | ||
defaultValue={'notanemail, testing array'} | ||
name="emailAddresses" | ||
/> | ||
{this.renderErrors(errors.emailAddresses)} | ||
<Button onClick={() => alert('sure is')} disabled={!isFieldValid.emailAddresses}> | ||
Thats an Email! | ||
</Button> | ||
<Form.Field> | ||
<label>Your Phone number</label> | ||
<input name="phoneNumber" onChange={onChange} /> | ||
{this.renderErrors(errors.phoneNumber)} | ||
</Form.Field> | ||
<Button onClick={() => alert('is it?')} disabled={!isFieldValid.phoneNumber}> | ||
Its a phone number | ||
</Button> | ||
<Form.Field> | ||
<label>Your Website (this uses the isUrl rule)</label> | ||
<input name="url" onChange={onChange} /> | ||
{this.renderErrors(errors.url)} | ||
</Form.Field> | ||
<Button onClick={() => alert('sure is')} disabled={!isFieldValid.url}> | ||
Some Url | ||
</Button> | ||
<Form.Field> | ||
<label>Your Name</label> | ||
<input name="name" onChange={onChange} /> | ||
{this.renderErrors(errors.name)} | ||
</Form.Field> | ||
<Button onClick={() => alert('sure is')} disabled={!isFieldValid.name}> | ||
This is your Name | ||
</Button> | ||
{<span>Form is {isFormValid ? 'valid' : 'not valid'}</span>} | ||
<hr /> | ||
<Button disabled={!isFormValid}>Test</Button> | ||
<Modal trigger={<Button content="trigger" />}> | ||
<Modal.Content> | ||
<Form> | ||
<Form.Field | ||
control={'input'} | ||
label="Your emails" | ||
onChange={onChange} | ||
defaultValue={''} | ||
name="emailAddresses" | ||
/> | ||
{this.renderErrors(errors.emailAddresses)} | ||
<Button onClick={() => alert('sure is')} disabled={!isFieldValid.emailAddresses}> | ||
Thats an Email! | ||
</Button> | ||
<Form.Field> | ||
<label>Your Phone number</label> | ||
<input name="phoneNumber" onChange={onChange} /> | ||
{this.renderErrors(errors.phoneNumber)} | ||
</Form.Field> | ||
<Button onClick={() => alert('is it?')} disabled={!isFieldValid.phoneNumber}> | ||
Its a phone number | ||
</Button> | ||
<Form.Field> | ||
<label>Your Website (this uses the isUrl rule)</label> | ||
<input name="url" onChange={onChange} /> | ||
{this.renderErrors(errors.url)} | ||
</Form.Field> | ||
<Button onClick={() => alert('sure is')} disabled={!isFieldValid.url}> | ||
Some Url | ||
</Button> | ||
<Form.Field> | ||
<label>Your Name</label> | ||
<input name="name" onChange={onChange} /> | ||
{this.renderErrors(errors.name)} | ||
</Form.Field> | ||
<Button onClick={() => alert('sure is')} disabled={!isFieldValid.name}> | ||
This is your Name | ||
</Button> | ||
{<span>Form is {isFormValid ? 'valid' : 'not valid'}</span>} | ||
<hr /> | ||
<Button disabled={!isFormValid}>Test</Button> | ||
{`hasChanged: ${hasChanged.emailAddresses}`} | ||
</Form> | ||
{`hasChanged: ${hasChanged.emailAddresses}`} | ||
</Form> | ||
</Modal.Content> | ||
</Modal> | ||
) | ||
@@ -130,0 +134,0 @@ }} |
@@ -32,2 +32,3 @@ const emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ | ||
validator: data => { | ||
if (data === undefined) return false | ||
if (data.match(emailRegex)) return true | ||
@@ -34,0 +35,0 @@ return false |
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
397553
795