How to use the redux-form.changeWithKey function in redux-form

To help you get started, we’ve selected a few redux-form examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lemonCMS / redux-form-generator / src / types / checkboxListiOs.js View on Github external
onChange(e, value) {
    const {properties} = this.props;
    let values = _.get(properties, 'value') || _.get(properties, 'initialValue', []);

    if (typeof values !== 'object') {
      values = [values];
    }
    if (e.target.checked === true) {
      values.push(value);
    } else {
      values.splice(_.indexOf(values, value), 1);
    }

    if (_.has(this.props, 'formKey')) {
      this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, _.uniq(values)));
    } else {
      this.props.dispatch(change(this.props.formName, this.props.field.name, _.uniq(values)));
    }
  }
github lemonCMS / redux-form-generator / src / types / DropDown.js View on Github external
return new Promise((resolve) => {
      if (_.has(this.props, 'formKey')) {
        resolve(this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, name, item.value)));
      } else {
        resolve(this.props.dispatch(change(this.props.formName, name, item.value)));
      }

    }).then(()=> {
      if (!!this.props.field.submit && typeof this.props.submit === 'function') {
github lemonCMS / redux-form-generator / example / src / generator / types / CheckboxListiOs.js View on Github external
onChange(e, value) {
    const values = this.state.selected;

    if (e.target.checked === true) {
      values.push(value);
    } else {
      values.splice(_.indexOf(values, value), 1);
    }

    if (_.has(this.props, 'formKey')) {
      this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, _.uniq(values)));
    } else {
      this.props.dispatch(change(this.props.formName, this.props.field.name, _.uniq(values)));
    }
  }
github lemonCMS / redux-form-generator / example / src / generator / types / Resource.js View on Github external
onChange(e, value) {
    const {properties} = this.props;
    let values = _.get(properties, 'value') || _.get(properties, 'initialValue', []);

    if (typeof values !== 'object') {
      values = [values];
    }
    if (e.target.checked === true) {
      values.push(value);
    } else {
      values.splice(_.indexOf(values, value), 1);
    }

    if (_.has(this.props, 'formKey')) {
      this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, _.uniq(values)));
    } else {
      this.props.dispatch(change(this.props.formName, this.props.field.name, _.uniq(values)));
    }
  }
github lemonCMS / redux-form-generator / src / types / checkboxList.js View on Github external
onChange(e, value) {
    const {properties} = this.props;
    let values = _.get(properties, 'value') || _.get(properties, 'initialValue', []);

    if (typeof values !== 'object') {
      values = [values];
    }
    if (e.target.checked === true) {
      values.push(value);
    } else {
      values.splice(_.indexOf(values, value), 1);
    }

    if (_.has(this.props, 'formKey')) {
      this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, _.uniq(values)));
    } else {
      this.props.dispatch(change(this.props.formName, this.props.field.name, _.uniq(values)));
    }

  }
github lemonCMS / redux-form-generator / src / types / rte.js View on Github external
handleEditorChange(e) {

    if (_.has(this.props, 'formKey')) {
      this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, e.target.getContent()));
    } else {
      this.props.dispatch(change(this.props.formName, this.props.field.name, e.target.getContent()));
    }
  }
github lemonCMS / redux-form-generator / src / types / Checkbox.js View on Github external
onChange(e) {
    const values = this.state.selected;

    if (e.target.checked === true) {

      values.push(e.target.value);
    } else {
      values.splice(_.indexOf(values, e.target.value), 1);
    }

    if (_.has(this.props, 'formKey')) {
      this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, _.uniq(values)));
    } else {
      this.props.dispatch(change(this.props.formName, this.props.field.name, _.uniq(values)));
    }
  }
github lemonCMS / redux-form-generator / example / src / generator / types / DropDown.js View on Github external
return new Promise((resolve) => {
      if (_.has(this.props, 'formKey')) {
        resolve(this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, name, item.value)));
      } else {
        resolve(this.props.dispatch(change(this.props.formName, name, item.value)));
      }

    }).then(()=> {
      if (!!this.props.field.submit && typeof this.props.submit === 'function') {
github lemonCMS / redux-form-generator / src / types / resource.js View on Github external
onChange(e, value) {
    const {properties} = this.props;
    let values = _.get(properties, 'value') || _.get(properties, 'initialValue', []);

    if (typeof values !== 'object') {
      values = [values];
    }
    if (e.target.checked === true) {
      values.push(value);
    } else {
      values.splice(_.indexOf(values, value), 1);
    }

    if (_.has(this.props, 'formKey')) {
      this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, _.uniq(values)));
    } else {
      this.props.dispatch(change(this.props.formName, this.props.field.name, _.uniq(values)));
    }
  }