🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

formulo

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formulo

simple stupid react forms

latest
Source
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

formulo - simple stupid react forms

npm version

Build Status

simple form

var Form = React.createClass({

  mixins: [formulo.FormMixin],

  getSchema() {
    return formulo.schema.Mapping({
      foo: formulo.schema.Scalar(_.isString),
      bar: formulo.schema.Scalar(x => _.isString(x) && x.length >= 3),
    });
  },

  render() {
    return (
      <form className={React.addons.classSet({active: this.state.isValid})}>
        <formulo.Field input={<input />} keyPath={['foo']} formContext={this.getFormContext()} />
        <formulo.Field input={<input />} keyPath={['bar']} formContext={this.getFormContext()} />
      </form>
    );
  }

});

list example

var Form = React.createClass({

  mixins: [formulo.FormMixin],

  getSchema() {
    return formulo.schema.Mapping({
      list: formulo.schema.Collection(formulo.schema.Scalar(v => v.length >= 3))
    });
  },

  getInitialValue() {
    return Immutable.Map({
      list: Immutable.List(['foo', 'bar'])
    });
  },

  render() {
    return (
      <form className={React.addons.classSet({active: this.state.isValid})}>
        {this.state.value.get('list').map(function(_, idx) {
          return <formulo.Field input={<input />} keyPath={['list', idx]} formContext={this.getFromContext()} key={idx} />
        }, this).toArray()};
      </form>
    );
  }

});

FAQs

Package last updated on 21 Jan 2015

Did you know?

Socket

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.

Install

Related posts