Name: spatialconnect-form-schema
Owner: Boundless
Description: null
Created: 2016-07-27 18:02:14.0
Updated: 2018-05-17 19:25:12.0
Pushed: 2018-05-17 19:25:10.0
Homepage: null
Size: 80
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Validates a SpatialConnect form schema and translates to a tcomb-json-schema.
npm install spatialconnect-form-schema
Example
rt scformschema from 'spatialconnect-form-schema';
rt transform from 'tcomb-json-schema';
rt t from 'tcomb-form';
form = {
: 2,
rsion: 0,
rm_key: "baseball_team",
rm_label: "Baseball Team",
elds: [{
id: 13,
type: "string",
field_label: "Favorite?",
field_key: "team",
position: 0
{
id: 14,
type: "string",
field_label: "Why?",
field_key: "why",
position: 1
t App = React.createClass({
nder() {
let { schema, options } = scformschema.translate(form);
return (
<form>
<t.form.Form
type={transform(schema)}
options={options}
/>
</form>
)
Validates a form schema and returns an array of errors.
Example
validationErrors = scformschema.validate(form);
For use in React Native applications, import the native build
rt scformschema from 'spatialconnect-form-schema/native';