![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
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 validated-form receives a total of 2 weekly downloads. As such, validated-form popularity was classified as not popular.
We found that validated-form demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.