by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    fingermark
    @fingermark
    @davidkpiano thanks a lot. that's much nicer. I had to use setFieldsErrors, though, because it wasn't showing an error message otherwise
    Basheer A Radman
    @ba2015sheer_twitter
    Thank you @alshamiri2
    Lukas Stuart-Fry
    @lstuartfry
    Hi @davidkpiano . I wanted to see if you got any notification of the issue I just opened on the repo, #884 . I only ask because I’m subscribed to the repo, and normally get an email any time a new issue is open, but I haven’t received one yet for this issue. I opened the issue yesterday. Absolutely no rush, just want to see if it made its way over to you.
    David Khourshid
    @davidkpiano
    Hey, yeah I saw it @lstuartfry no worries. I'm sure it's a weird race condition issue, will have to look deeper into it.
    Lukas Stuart-Fry
    @lstuartfry
    Much appreciated David! No rush at all, i’m using an older version of RRF in the meantime.
    Felix Henninger
    @FelixHenninger

    Hi everyone! I'm stuck and probably making some stupid mistake -- if you could spare a moment, I'd really appreciate a hint.

    In a nutshell, I'd like to build a basic component that shows some data in a <LocalForm /> and provides an update callback, like so:

    const MyForm = ({ data, onChange }) =>
      <LocalForm
        initialState={{ data }}
        onChange={ onChange }
      >
        <Control model="local.data" />
      </LocalForm>
    This is wrapped by a component that's connected to the store and which provides data as a prop, based on the current state.
    My problem is that the data inside the form control doesn't get updated when the app state changes, even though the component is clearly rerendered.
    Felix Henninger
    @FelixHenninger
    I'm guessing this is by design, and I haven't fully understood the mechanism, but I'd really like to figure this out. Any hints would be much appreciated. Thanks a lot!
    (oh, and a few more notes: There is more than one LocalForm on the page, but the result doesn't change if I remove the other one)
    (also, I'm running RRF 1.14.1 and react-redux 4.4.8)
    Felix Henninger
    @FelixHenninger
    Here's an example that's as minimal as I can make it: https://codepen.io/anon/pen/ayqjZR?editors=0010
    The weird thing is that I've had this working before, and must have broken it through refactoring.
    Felix Henninger
    @FelixHenninger
    Hmm, so I'm guessing that I might need a manual shouldComponentUpdate method somewhere ... I'll see if that helps.
    ... or forceUpdate?
    Felix Henninger
    @FelixHenninger
    Ok, I'm giving up for tonight, trying again tomorrow. If any of you could spare a moment, the tiniest pointers or hints would be massively appreciated!
    Felix Henninger
    @FelixHenninger
    Just a quick update: I hacked together a solution for this, by dispatching a change action to update the form's data from a wrapping component's componentWillUpdate method.
    This, however, strikes me as very un-react-like. Is there a better solution?
    Sean Yu
    @seanyu4296
    hi is it possible to not run immediately a certain validator of a <Form> component? an example of this is you dont want to tell your user his password does not match yet while he just started typing in the password field? @davidkpiano
    Sean Yu
    @seanyu4296
    is it also possible that the Control component be aware that it has an error. I want to make the input border red when on error. if so can you guys help me out :worried:
    Sean Yu
    @seanyu4296

    okay after looking through the docs and some issues posted by people i think this is the solution for my question number 2

    ```

    <Control.text model="myForms.user.email" placeholder="username" mapProps={{ withError: ({ fieldValue }) => {
    if (fieldValue.touched) {
    return !fieldValue.valid;
    }
    return false;
    }
    }}
    validators={{
    required: val => val && val.length
    }}
    validateOn="change"
    />
    ```the solution you @davidkpiano gave here davidkpiano/react-redux-form#441

    automatically sets the withError props to true on render so i added the fieldValue.touched if statement so that it is not automatically set to true on render not sure if that's correct way to go @davidkpiano . do you have any suggestions @davidkpiano ?
    Felix Henninger
    @FelixHenninger
    Just as a quick update to my posts above, I woke up today and remembered the key prop, which solves all my issues magnificently. d'oh!
    Sorry for bothering you all with my public rubber-ducking, and thanks for this fantastic library! I'm really excited for the latest developments and v2!
    Ken Wallace
    @boaticus

    Anyone have an example of changing a control's disabled prop based on the modelValue of a checkbox control elsewhere in the form?

    Imagine a form with a checkbox and a text field (text field is disabled by default). If the checkbox is checked, then the text field should become editable.

    I can't seem to make it work.

    Ken Wallace
    @boaticus
    Alright, I got it worked out using normal setState pattern in the onChange handler on the checkbox.
    Sean Yu
    @seanyu4296
    There seems to be a weird bug when im using actions.merge with nested objects the validation for the nested object doesnt run correctly @davidkpiano please help :(
    kkashou
    @kkashou
    Could I get anyone's help on this ticket davidkpiano/react-redux-form#923
    David Khourshid
    @davidkpiano
    @seanyu4296 Can you please file a bug?
    Chris Mckay
    @Errorific
    Hi, I'm having some issues with how to hide fields in a form based on other values in the form and was wondering if anyone could point me in the right direction?
    need to hide or unrender some of the fields based on the value of a combobox at the top of the form. Have tried wiring the value of the combo box back into the form from the state but thats triggering re-rendering when I'm typing in other fields and loses focus. Thought maybe mapProps with hidden on the fields that I need to disappear but it doesn't seem like the full form state is available on the fields mapProps.
    pretty sure I'm just missing something obvious in the docs
    David Khourshid
    @davidkpiano
    @Errorific do you have some existing code you can show?
    you can always make a custom control that depends on a certain model
    Chris Mckay
    @Errorific
    I can whip up some code, but theres nothing special in what i'm starting with, just controls wrapped around some customComponents that render the fields. The way I had it losing focus was obviously wrong, I had it listening to too much of the model.
    custom control is always a possibility, was hoping there was a simpler way of visiting the model the form is using from the control
    or maybe is there a way to tell a control to use a model of x.y and use x.y.val as its value for display and validation purposes? then stick some more state beside it like x.y.hidden that I can use in mapProps to feed to the customComponent?
    David Khourshid
    @davidkpiano
    I mean, it's all just redux... every single value that you can possibly ever need is in the redux store
    so just grab it from there
    Chris Mckay
    @Errorific
    That's right I guess, I'm overthinking this somewhere. I think I'm getting stuck on how the controls are being pointed at a specific part of the model and they don't have visibility outside of that, but they do because redux.
    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?