boundlessgeo/spatialconnect-form-schema

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Validates a SpatialConnect form schema and translates to a tcomb-json-schema.

Install

npm install spatialconnect-form-schema

API

translate(form: SCForm): JSONSchema

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>
)


validate(form: SCForm): Array

Validates a form schema and returns an array of errors.

Example

validationErrors = scformschema.validate(form);
React Native

For use in React Native applications, import the native build

rt scformschema from 'spatialconnect-form-schema/native';

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.