How to use the redux-form/immutable.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 peerplays-network / BookiePro / src / components / ChangePassword / ChangePasswordForm.jsx View on Github external
* @param {string} password - the password field value to validate
 * @param {string} blankFieldErrorMessage - the error message to be displayed
 * when the password value is empty
 * @param {string} minimumLengthErrorMessage - the error message to be displayed
 * when the password value is too short
 */
const validateChangePasswordFields = (password,blankFieldErrorMessage,minimumLengthErrorMessage) => {
  const minimumLength = 22;
  if (!password || password.trim() === '') {
    return blankFieldErrorMessage;
  } else if(password.length < minimumLength){
    return minimumLengthErrorMessage;
  }
}

export default reduxForm({
  form: 'changePasswordForm',  // a unique identifier for this form
  fields: ['old_password', 'new_password', 'new_password_confirm'],
  validate: function submit(values) {
    let errors = {},
      new_password = values.get('new_password'),
      new_password_confirm = values.get('new_password_confirm');
    const minimumLengthErrorMessage = I18n.t('changePassword.min_pwd_error');
    //Old password validations
    errors.old_password = validateChangePasswordFields(values.get('old_password'),
                          I18n.t('changePassword.enter_old_password'),minimumLengthErrorMessage)
    //New password validations
    errors.new_password = validateChangePasswordFields(new_password,
                          I18n.t('changePassword.enter_new_password'),minimumLengthErrorMessage)
    //Confirm-New password validations
    errors.new_password_confirm = validateChangePasswordFields(new_password_confirm,
                          I18n.t('changePassword.confirm_new_password'),minimumLengthErrorMessage)
github peerplays-network / BookiePro / src / components / Signup / SignupForm.jsx View on Github external
<div>
          <p>
            {' '}
            {I18n.t('signup.already_account')}{' '}
            <a href="#">
              {' '}
              {I18n.t('signup.log_in')}{' '}
            </a>{' '}
          </p>
        </div>
      
    );
  }
}

export default reduxForm({
  form: 'registerAccountForm', // a unique identifier for this form
  fields: ['accountName', 'password', 'password_retype', 'secure', 'understand'],
  //Form field validations
  validate: function submit(values) {
    let errors = {};
    //Account name field validations
    let accountError = ChainValidation.is_account_name_error(values.get('accountName'));

    if (accountError) {
      errors.accountName = accountError;
    } else {
      if (!ChainValidation.is_cheap_name(values.get('accountName'))) {
        errors.accountName = I18n.t('signup.premium_acc_text');
      }
    }
github alexolefirenko / react-admin-ui / src / components / Entity / List / Filters / Form.js View on Github external
display: flex;
    align-items: center;
`

// const styleClearButton = {
//     marginRight: '10px'
// }

const styleButton = {
}

const WrapperButtons = styled.div`

`

@reduxForm()
export default class FiltersForm extends React.Component {

    componentWillReceiveProps(nextProps) {
        if (nextProps.location.pathname != this.props.location.pathname) {
            this.props.destroy()
        }
    }

    filterClear = () => {
        this.props.destroy()
        this.props.dispatch(push(this.props.location.pathname))
    }

    render() {
        const {filters, handleSubmit} = this.props
        return (
github machawk1 / wail / wail-ui / components / collections / addToCollection / seedList.js View on Github external
moreThanOne (wsLen, page, warcSeeds, onSubmit, formConfig) {
    let FormPage = reduxForm(formConfig)(SeedListItem)
    if (page &lt; wsLen - 1 &amp;&amp; page &gt; 0) {
      return ()
    } else if (page === wsLen - 1) {
      return ()
    } else {
      return ()
    }
  }
github yankouskia / MUISCRR-boilerplate / src / pages / Feedback.js View on Github external
);
  }
}

const formSelector = formValueSelector(FORM_NAME);

const mapStateToProps = state => ({
  formValues: formSelector(state, ...REQUIRED_FIELDS),
});

const mapDispatchToProps = dispatch => ({
  send: () => dispatch({ type: SEND_FEEDBACK }),
});

const withConnect = connect(mapStateToProps, mapDispatchToProps);
const withForm = reduxForm({ form: FORM_NAME, validate });

export default withForm(withConnect(Feedback));
github machawk1 / wail / wail-ui / components / twitter / archiveConfig / textSearch / userBasic.js View on Github external
hintText='WebSciDl'
            name='screenName'
            component={TextField}
            fullWidth={true}
          /&gt;
        
        
        
          
        
      
    )
  }
}

export default reduxForm(formConfig)(UserBasic)
github jackdh / RasaTalk / app / containers / LoginPage / RegisterForm.js View on Github external
)}
          {loading &amp;&amp; }
        
      
    );
  }
}

RegisterForm.propTypes = {
  handleSubmit: PropTypes.func,
  registerError: PropTypes.string,
  loading: PropTypes.bool,
};

const withForm = reduxForm({
  form: 'registerPage',
  validate,
});

export default compose(withForm)(RegisterForm);
github jackdh / RasaTalk / app / containers / EditNode / index.js View on Github external
};

const mapStateToProps = createStructuredSelector({
  editnodetwo: makeSelectEditNode(),
  values: getFormValues('EditNode'),
  isActive: selectActive(),
  headNode: selectHead(),
});

function mapDispatchToProps(dispatch) {
  return {
    dispatch,
  };
}

const withForm = reduxForm({ form: 'EditNode', validate });
const withConnect = connect(
  mapStateToProps,
  mapDispatchToProps,
);
const withReducer = injectReducer({ key: 'editNode', reducer });
const withSaga = injectSaga({ key: 'editNode', saga });

export default compose(
  withReducer,
  withSaga,
  withForm,
  withConnect,
)(EditNode);
github machawk1 / wail / wail-ui / components / dialogs / newCollectionForm / index.js View on Github external
)

NewCollectionForm.propTypes = {
  onSubmit: PropTypes.func.isRequired,
  onCancel: PropTypes.func.isRequired
}

export default reduxForm(formConfig)(NewCollectionForm)