How to use the redux-form.reduxForm 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 reportportal / service-ui / app / src / pages / admin / projectsPage / modals / addProjectModal.jsx View on Github external
import { injectIntl, intlShape } from 'react-intl';
import { reduxForm } from 'redux-form';
import { FieldErrorHint } from 'components/fields/fieldErrorHint';
import { FieldProvider } from 'components/fields/fieldProvider';
import { Input } from 'components/inputs/input';
import { validate, bindMessageToValidator, validateAsync } from 'common/utils';
import { ModalLayout, withModal, ModalField } from 'components/main/modal';
import { SectionHeader } from 'components/main/sectionHeader';
import { COMMON_LOCALE_KEYS } from 'common/constants/localization';
import { messages } from './../messages';

const LABEL_WIDTH = 105;

@withModal('addProjectModal')
@injectIntl
@reduxForm({
  form: 'addProjectForm',
  validate: ({ projectName }) => ({
    projectName: bindMessageToValidator(validate.projectName, 'projectNameLengthHint')(projectName),
  }),
  asyncValidate: ({ projectName }) => validateAsync.projectNameUnique(projectName),
  asyncChangeFields: ['projectName'],
  asyncBlurFields: ['projectName'], // validate on blur in case of copy-paste value
})
export class AddProjectModal extends Component {
  static propTypes = {
    intl: intlShape.isRequired,
    data: PropTypes.object,
    dirty: PropTypes.bool,
    handleSubmit: PropTypes.func,
    change: PropTypes.func,
  };
github mitmedialab / MediaCloud-Web-Tools / src / components / common / admin / users / UserPermissionsForm.js View on Github external
UserPermissionsForm.propTypes = {
  // from compositional chain
  intl: PropTypes.object.isRequired,
  renderCheckbox: PropTypes.func.isRequired,
  initialValues: PropTypes.object,
};

const reduxFormConfig = {
  form: 'userForm',
};

export default
injectIntl(
  withIntlForm(
    reduxForm(reduxFormConfig)(
      UserPermissionsForm
    )
  )
);
github tomlagier / crypto-dca / app / src / components / AddCoinDialog / index.tsx View on Github external
/>
      <h4>Exchange wallet</h4>
      
      <button>Submit</button>
    
  
);

export default compose(
  withApollo,
  withWallets,
  filterWallets,
  reduxForm({
    form: 'addCoin',
    initialValues: {
      localWallet: 'new',
      exchangeWallet: 'new'
    }
  })
)(AddCoinDialog);
github lxerxa / actionview-fe / app / components / setting / sys / ResetPwdModal.jsx View on Github external
import { reduxForm } from 'redux-form';
import { Modal, Button, ControlLabel, FormControl, FormGroup, HelpBlock } from 'react-bootstrap';
import { notify } from 'react-notify-toast';
import _ from 'lodash';

const img = require('../../../assets/images/loading.gif');

const validate = (values, props) => {
  const errors = {};
  if (!values.send_auth_pwd) {
    errors.send_auth_pwd = 'ๅฟ…ๅกซ';
  }
  return errors;
};

@reduxForm({
  form: 'sysetting',
  fields: ['send_auth_pwd'],
  validate
})
export default class ResetPwdModal extends Component {
  constructor(props) {
    super(props);
    this.state = { ecode: 0 };
    this.handleSubmit = this.handleSubmit.bind(this);
    this.handleCancel = this.handleCancel.bind(this);
  }

  static propTypes = {
    i18n: PropTypes.object.isRequired,
    submitting: PropTypes.bool,
    invalid: PropTypes.bool,
github Nebo15 / annon.web / app / common / containers / forms / ApiForm / index.js View on Github external
import FieldInput from 'components/reduxForm/FieldInput';
import { CheckboxGroup } from 'components/reduxForm/FieldCheckboxGroup';
import FiledSelect from 'components/reduxForm/FieldSelect';

import Button from 'components/Button';
import Line from 'components/Line';
import { H3 } from 'components/Title';

import ConfirmFormChanges from 'containers/blocks/ConfirmFormChanges';

import { reduxFormValidate } from 'react-nebo15-validate';

import styles from './styles.scss';

@withStyles(styles)
@reduxForm({
  form: 'api-form',
  initialValues: {
    request: {
      scheme: 'http',
    },
  },
  validate: reduxFormValidate({
    name: {
      required: true,
    },
    'request.host': {
      required: true,
    },
    'request.path': {
      required: true,
    },
github reportportal / service-ui / app / src / pages / inside / common / modals / editItemsModal / editItemsModal.jsx View on Github external
value: DESCRIPTION_LEAVE,
    label: formatMessage(messages.descriptionLeaveLabel),
  },
  {
    value: DESCRIPTION_UPDATE,
    label: formatMessage(messages.descriptionAddLabel),
  },
  {
    value: DESCRIPTION_CREATE,
    label: formatMessage(messages.descriptionReplaceLabel),
  },
];

@withModal('editItemsModal')
@injectIntl
@reduxForm({
  form: 'editItemsForm',
  validate: ({ commonAttributes }) => ({
    commonAttributes: !validate.attributesArray(commonAttributes),
  }),
})
@formValues('descriptionAction', 'uniqueAttributes')
@connect(
  (state) => ({
    currentProject: activeProjectSelector(state),
  }),
  {
    showNotification,
    showDefaultErrorNotification,
  },
)
export class EditItemsModal extends Component {
github lxerxa / actionview-fe / app / components / gantt / EditModal.jsx View on Github external
if (values.expect_start_time &amp;&amp; values.expect_complete_time) {
    if (values.expect_start_time &gt; values.expect_complete_time) {
      errors.expect_start_time = 'ๅผ€ๅง‹ๆ—ถ้—ด่ฆๆ—ฉไบŽ็ป“ๆŸๆ—ถ้—ด';
    }
  }

  if (props.mode == 'progress' &amp;&amp; values.progress) {
    if (isNaN(values.progress) || values.progress &lt; 0) {
      errors.progress = 'ๆ ผๅผ้”™่ฏฏ';
    }
  }

  return errors;
};

@reduxForm({
  form: 'ganttedit',
  fields: [ 'expect_start_time', 'expect_complete_time', 'progress' ],
  validate
})
export default class EditModal extends Component {
  constructor(props) {
    super(props);
    this.state = { ecode: 0 };
    this.handleSubmit = this.handleSubmit.bind(this);
    this.handleCancel = this.handleCancel.bind(this);
  }

  static propTypes = {
    i18n: PropTypes.object.isRequired,
    mode: PropTypes.string.isRequired,
    submitting: PropTypes.bool,
github Nebo15 / annon.web / app / common / containers / forms / PluginProxyForm / index.js View on Github external
import React from 'react';
import withStyles from 'nebo15-isomorphic-style-loader/lib/withStyles';
import { reduxForm, Field, FormSection } from 'redux-form';

import FieldInput from 'components/reduxForm/FieldInput';
import FieldCheckbox from 'components/reduxForm/FieldCheckbox';
import FiledSelect from 'components/reduxForm/FieldSelect';

import Line from 'components/Line';

import { reduxFormValidate } from 'react-nebo15-validate';

import styles from './styles.scss';

@reduxForm({
  form: 'plugin-settings-form',
  initialValues: {
    settings: {
      scheme: 'http',
    },
  },
  validate: reduxFormValidate({
    'settings.host': {
      required: true,
    },
    'settings.port': {
      required: true,
    },
    'settings.path': {
      required: true,
    },
github lxerxa / actionview-fe / app / components / workflow / DelActionModal.jsx View on Github external
import React, { PropTypes, Component } from 'react';
import { reduxForm } from 'redux-form';
import { Modal, Button, ControlLabel, FormControl, FormGroup } from 'react-bootstrap';
import Select from 'react-select';
import { Checkbox, CheckboxGroup } from 'react-checkbox-group';
import _ from 'lodash';

const validate = (values) => {
  const errors = {};
  if (!values.actions) {
    errors.actions = 'Required';
  }
  return errors;
};

@reduxForm({
  form: 'delAction',
  fields: [ 'actions' ],
  validate
})
export default class DelActionModal extends Component {
  constructor(props) {
    super(props);
    this.handleSubmit = this.handleSubmit.bind(this);
    this.handleCancel = this.handleCancel.bind(this);
  }

  static propTypes = {
    data: PropTypes.object,
    stepData: PropTypes.object,
    submitting: PropTypes.bool,
    invalid: PropTypes.bool,
github lxerxa / actionview-fe / app / components / directory / EditModal.jsx View on Github external
import { reduxForm } from 'redux-form';
import { Modal, Button, ControlLabel, FormControl, FormGroup, HelpBlock } from 'react-bootstrap';
import _ from 'lodash';
import { notify } from 'react-notify-toast';

const img = require('../../assets/images/loading.gif');

const validate = (values, props) => {
  const errors = {};
  if (!values.name) {
    errors.name = 'ๅฟ…ๅกซ';
  } 
  return errors;
};

@reduxForm({
  form: 'group',
  fields: [ 'id', 'name', 'description' ],
  validate
})
export default class CreateModal extends Component {
  constructor(props) {
    super(props);
    this.state = { ecode: 0 };
    this.handleSubmit = this.handleSubmit.bind(this);
    this.handleCancel = this.handleCancel.bind(this);
  }

  static propTypes = {
    i18n: PropTypes.object.isRequired,
    submitting: PropTypes.bool,
    invalid: PropTypes.bool,