Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-form-validator-component

Package Overview
Dependencies
Maintainers
3
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-form-validator-component - npm Package Compare versions

Comparing version 1.7.13 to 1.7.14

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc