1.0.2 • Published 5 years ago
@formalize/react-formalize v1.0.2
React Formalize
A library made to simplify your life when handling complex forms, now you don't have to worry about indexing, saving values and keeping everything updated.
Installation
Direct download
Download the script here and include it (unless you are packaging scripts somehow else):
<script src="/path/to/react.formalize.js"></script>
NPM
$ npm install formalize/react-formalize --save
Basic Usage
Require our namespace into the file
require {Form, Input, Group, Select, TextArea, Button} from "formalize/react-formalize";
Now we can create a simple demonstration that handles a contact me form
<Form onChange={} onSubmit={}>
<Group name="user">
<Input name="name" className="form-control" onChange={} />
<Input name="email" className="form-control" onChange={} />
</Group>
<TextArea name="message" onChange={} />
<Button className="btn btn-primary">Submit</Button>
</Form>
Customization
For greater control over your forms, you can wrap the inputs inside other components to create filters. Different from javascript vanilla onChange and onSubmit. We do the following:
- We return directly the value from the first argument, and the second one has the node
- You return false or null to the onChange callback to cancel change, the same goes for the form onchange
- Return the desired value to be applied
- Return false to the onSubmit function to clear the form, null will keep it the same way
Security
For vulnerability reports, send an e-mail to rafael.correa@quantik.com.br