0.2.2 • Published 7 years ago

react-vedora-form v0.2.2

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

React Vedora Form

The form generator for React JS that is easy to use, has been integrated with complete validation

Installation

npm i react-vedora-form

Usage

JSX

import React, { Component } from 'react'
import { FormPackage } from 'react-vedora-form'

class ExampleComponent extends Component {
  constructor(){
    super()
    this.forms = [
      {
        'label': 'Example Field',
        'name': 'field',
        'type': 'text',
        'format': 'input-text',
        'rules': 'required|min_length[3]|max_length[8]',
      }
    ]
  }

  onSubmitForm(valueForm){
    
  }

  render() {
    return (
      <FormPackage 
          forms={this.forms}   
          onSubmit={this.onSubmitForm.bind(this)}
      />
    )
  }
}

API

Props

PropertyTypeDefaultDescription
formsarraynullThe list of setting for fields in the form
onSubmitfunctionundefinedThe function that will be called when the submit button on the form is pressed and will get the return value of the form fill

Validation Rules

RuleParameterDescriptionExample
requiredNoReturns FALSE if the form element is empty-
min_lengthYesReturns FALSE if the form element is shorter than the parameter valuemin_length3
max_lengthYesReturns FALSE if the form element is longer than the parameter valuemax_length12
0.2.2

7 years ago

0.2.1

7 years ago

0.1.0

7 years ago

0.2.0

7 years ago