by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Chris Mckay
    @Errorific
    I've got something that works now passing the model field I want out of the forms state into the component that renders my form and switching the fields on and off with that, but it feels like I'm pulling the data from the wrong place. I'll see where I get to with what I have. Thanks
    Dima Doronin
    @ddoronin
    hey!
    First of all, the library is AWESOME! Really!
    But could anybody share good docs or git how to write unit tests for the forms?
    :)
    I was trying to find it in documentation, but without success
    maybe it's there, but I just don't see it...
    Dima Doronin
    @ddoronin
    actually I already found one great example here:
    https://github.com/tylercollier/redux-form-test
    it would be a good idea to reference this repo in docs
    David Khourshid
    @davidkpiano
    @ddoronin that's for redux-form, not react-redux-form
    are you using react-redux-form or redux-form?
    kkashou
    @kkashou
    Hello ... was wondering if I can get any help on this issue davidkpiano/react-redux-form#923
    write2art
    @write2art
    Hello! Have somebody tried to integrate react-datepicker with react-redux-form?
    Kalle Mäkynen
    @kallemakynen
    Hey @davidkpiano. Is there some reasoning behind not "allowing" <Errors /> component's messages to be an object? The component works fine even if it is an object, but I get type error in the browser console: "Failed prop type: Invalid prop messages.isRequired supplied to Errors"
    kkashou
    @kkashou
    @write2art ... yes I have and it works great with it. What questions do you have regarding it ?
    Emmanuel Villegas
    @Ragnarok99
    hi i need a hand with something
    is someone there?
    :)
    write2art
    @write2art
    @kkashou how exactly have you achieved it? My setup is working, but seems a little bit sophisticated to me:
    class DatePickerInput extends Component {
      constructor (props) {
        super(props)
        this.state = {
          startDate: props.value ? moment.unix(props.value) : ''
        };
        this.handleChange = this.handleChange.bind(this);
      }
    
      handleChange(date) {
        this.setState({
          startDate: date
        });
        this.props.onChange(date)
      }
    
      render() {
        return <DatePicker
          name={this.props.name}
          className="form-control"
          dateFormat="DD MMM YYYY"
          locale="ru-ru"
          readOnly={true}
          selected={this.state.startDate}
          onChange={this.handleChange}
          minDate={this.props.minDate}
          maxDate={this.props.maxDate}
          placeholderText="Выберите дату"
        />;
      }
    }
    
    export default class DatePickerControl extends Component {
      customInput(props) {
        return (<DatePickerInput {...props}/>);
      }
    
      render() {
        return (
          <div className="form-group">
            { this.props.label &&
            <label className="control-label" htmlFor={this.props.id}>{this.props.label}</label>}
            <Control {...this.props} className="form-control" component={this.customInput} getValue={(moment) => {
              return parseInt(isNaN(parseInt(moment)) ? moment.format("X") : moment);
            }}/>
          </div>
        );
      }
    }
    Billy Le
    @lebilly

    Hello everyone! I'm fairly new to react and redux and my team is currently using react-redux-form. I have a question but there is some context before I ask.

    I have a form, say the model is 'team', that will make a request to retrieve all data from the db, say 'users', when the component mounts. This users data will have a list of id's and a names. I will map over the names over a dropdown list using the Control.select and the model will point be "team.user.name".

    So what I want to do is use the id to pass in with every option because my model needs the "team.user.id" to save to the db on submit. How is this done?

    David Khourshid
    @davidkpiano
    why not map over the IDs to start with?
    and then display the names based on the IDs (but don't have the names be the values of the options)
    Billy Le
    @lebilly
    Yeah, that's what I ended up doing :) Thanks tho! Took me another day to figure it out.
    kkashou
    @kkashou
    @write2art That sounds about right how I would have done it. What part specifically are you looking at that is little bit sophisticated?
    Lukas Stuart-Fry
    @lstuartfry
    Does anyone have any experience in writing debounced validators? All my ‘change’ actions are debounced 300ms, and I’m trying to figure out the best way to implement a 300ms delay on all my validators.
    Lukas Stuart-Fry
    @lstuartfry
    I’m not handling validation through any manual dispatch actions.
    const required = () => ({ validator: (val) => (val && val.length) });
    <Control
         validators: { required: required().validator }
    />
    Lukas Stuart-Fry
    @lstuartfry
    Actually, this was completely my error. I can leave this message here as a warning for others, but my Control field was actually using a validateOn=“blur” only. Since the model change was debounced 300ms, if a user ‘tabs’ or clicks out of the field before the model can update, it will register as invalid.
    Terry
    @tmcdonnell87
    Was there any breaking change between 1.14 and 1.16? I just upgraded and all of my wrapped controls broke. I can start digging in but if there's a documented upgrade guide would prefer to start there
    It now appears all of my props are being passed straight down to the <input>
    For example, <input label="Email Address" placeholder="Your email" controlprops="[object Object]" validators="[object Object]" messages="[object Object]" name="registration.email" value="a@b.com" fieldprops="[object Object]" class="form-control">
    Terry
    @tmcdonnell87
    Appears it was actually between 1.14.2 and 1.14.4...
    Terry
    @tmcdonnell87
    Circling back to ^, it's a minor problem and logged here: davidkpiano/react-redux-form#1021
    Chris Gruel
    @devorbitus
    Hiya, could someone point me towards some examples of unit testing forms created with react-redux-form. I have a feeling I am over complicating it but would like a reference to be sure.
    David Khourshid
    @davidkpiano
    @devorbitus look at the RRF unit tests. it's not too hard
    the process is just creating a store like you would with combineForms and then selecting inputs, and entering text into them, and checking that the store has the right value.
    Baruch Kogan
    @boriskogan81
    hi, guys. Could anyone explain to me how to initialize field arrays with some field length? the example has a button that is linked to fields.push in the stateless method, but I'd like to start off with several fields, and can't figure it out
    David Khourshid
    @davidkpiano
    @boriskogan81 wrong repo
    kkashou
    @kkashou
    is there a way to not clear all the forms input when a reset button has been pressed?
    Christian Kaps
    @akkie
    What would be the best way to sanitize a value before it gets updated in store?
    karthidec
    @karthidec
    Does anyone have an example of a custom component integrated with react-redux-form? We would like to see the implementation of the custom component which integrates with validatations on the form.
    Rich Buggy
    @richbuggy_twitter
    If I'm using LocalForm and I dispatch actions.submit("model-name") and everything is valid should it not result in the onSubmit handler being called?
    LeeHyungGeun
    @LeeHyungGeun

    How can I change a field of LocalForm?

    <Control.text model=".text">

    <Control.text model=".text"
    David Khourshid
    @davidkpiano
    What do you mean?
    LeeHyungGeun
    @LeeHyungGeun
    Never Mind. I solved it with Github documentation. Actually, I didn't know how to change the model of LocalForm
    attachDispatch(dispatch) {
      this.formDispatch = dispatch
    }
    handleSubmit(val) {
      this.formDispatch(actions.change('local.text', ''))
    }
    <LocalForm getDispatch={(dispatch) => this.props.attachDispatch(dispatch)} />
    AnsonT
    @AnsonT
    Field changes that affect other fields. What's the recommended way to update (normalize) the model after a field change? Would be great to have an actions.normalize(model, values => updatedValues )
    Brad Wertman
    @bmwertman

    I'm following the Quick Start guide for react-redux-form to add it to my react app with a redux reducer and store that are already in place. The redux createStore method keeps throwing an error "Object is not a function"

    import { createStore } from 'redux';
    import { createForms, combineReducers } from 'react-redux-form'
    import rootReducer from '../reducers/index';
    import userReducer from '../reducers/user';
    
    const initialUserState = {
      firstName: '',
      lastName: ''
    }
    
    const store = createStore(
      combineReducers(
        {
        root: rootReducer,
        user: userReducer,
        ...createForms({
          user:initialUserState,
        }),
      })
    );
    
    export default store;

    Any help as to what I may be doing wrong?