
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
pronto-validated-form
Advanced tools
Helpers for creating a form with validated fields.
fields
An object of field names and options {name: options, ...}
. See field options for more informationvalues
An object of field values {name: value, ...}
onSubmit(values)
A function to be called when the form is submitted (only if fields are valid)<ValidatedForm ref='form' fields={
city: {}
state: {placeholder: 'e.g. "NY" or "MA"'}
county: {optional: true}
} onSubmit={({city, state, county}) -> alert(city + ' is in ' + state) } />
name
Name of this fieldtype
One of "text", "number", "email", or "toggle", default is "text"placeholder
A placeholder, default is the un-slugified field nameerror_message
Message to show if field is invalidhidden
A boolean or function to determine if this field is hiddenoptional
A boolean or function to determine if this field is optionalThe ValidatedFormMixin
provides methods for rendering fields, keeping track of fields state, and checking that fields are valid.
getInitialState() -> {values}
required
getInitialState
that returns at least an empty values: {}
, because a React component does not have state by defaultvalues: {email: 'test@gmail.net'}
getDefaultProps() -> {fields, onSubmit}
onSubmit(values)
fields
An object of field names and options in the shape {name: options, ...}
. See field options for more informationonSubmit(values)
A function to be called when the form is submitted (only if fields are valid)values
An object of values by field namerenderField(name)
Render an individual field with the options in fields[name]
trySubmit()
A method that looks through fieldsclear()
Sets all field values to null{ValidatedFormMixin} = require 'validated-form'
FormTest = React.createClass
mixins: [ValidatedFormMixin]
getInitialState: ->
values:
name: 'test'
getDefaultProps: ->
fields:
name: {type: 'text'}
age: {type: 'number'}
email: {type: 'email'}
onSubmit: (values) ->
@setState {loading: true}
submitFormAnd =>
@clear()
@setState {loading: false}
render: ->
<div>
<form onSubmit=@trySubmit>
{@renderField 'name'}
{@renderField 'age'}
{@renderField 'email'}
<button>{if @state.loading then "Loading..." else "Submit"}</button>
</form>
</div>
FAQs
Helpers for creating a form with validated fields.
The npm package pronto-validated-form receives a total of 7 weekly downloads. As such, pronto-validated-form popularity was classified as not popular.
We found that pronto-validated-form demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.