redux-form

Redux Form Wrapped Inside Custom Portal Component?

南笙酒味 提交于 2019-12-11 06:05:49
问题 I keep getting this error when trying to put a redux-form inside a custom modal component I created: Error: Field must be inside a component decorated with reduxForm() . Basically, I have a view where the user sees their post. When the go to edit the name of their post, a form pops up using the modal component to display a redux form. When the user clicks the Save/Submit button on the modal, I want the form to validate and then callback to the parent post view component, which in turn will

How to conditionally add a className?

蹲街弑〆低调 提交于 2019-12-11 05:22:09
问题 I have the following with react-redux-form: <fieldset> <label>{label}</label> <div> <input {...input} name="email" type="text" className="form-control" /> {touched && error && <span className="error">{error}</span>} </div> </fieldset> I would like to be able to update <fieldset> with either className="" className="has-success" className="has-danger" The logic would be: If touched but no error : <fieldset className="has-success"> If touched and error : <fieldset className="has-danger"> If not

How to export redux form Field component?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 05:17:24
问题 I am trying to auto-fill a form's input values. I have a function called load which need to load the data when a button is clicked. I've been working with redux form, and I need to use the Field component to work with the initialValues prop. However, every time I add it I get this error: "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined

send the value as string when selecting the option

半腔热情 提交于 2019-12-11 04:18:28
问题 I am using react-select for autocomplete and option related field. When i select the option it passes whole that option object as {value: 'abc', label: 'ABC'} but i wanted only to pass the value as a string not the object. Thus, i used getOptionValue but it is not working as expected. This is what I have done <Field name='status' component={SearchableText} placeholder="Search..." options={status} styles={styles} getOptionLabel={option => option.label} getOptionValue={option => option.value} /

`formValueSelector` doesn't get the values if I go to the new page via changing URL

允我心安 提交于 2019-12-11 04:15:49
问题 I am using Redux-Form 7.3.0 and noticed that if go to other pages via changing the URL then if on the new page if I try to get values with formValueSelector it doesn't work - will be undefined . But if I go to the new page component via <Link to={'/blabla'}> (react-router-dom) it will be ok and I get the values. why? 来源: https://stackoverflow.com/questions/49601192/formvalueselector-doesnt-get-the-values-if-i-go-to-the-new-page-via-changing

How to access the redux store within the redux form

Deadly 提交于 2019-12-11 03:28:10
问题 I'm a newbie to the react-redux world, please correct me if I'm missing something: Basically I'm trying to access the hostname via redux store and use it inside the form. As of now I'm just using the hostname reference window.location within the redux form but I would like to access the hostname via the redux store/ via any other better approach so I can keep the function pure? Thoughts? Thanks Edit: import React from 'react' import { Field, reduxForm } from 'redux-form' const SimpleForm =

Display validation errors onSubmit with redux-form, and clear errors until next onSubmit on touch

淺唱寂寞╮ 提交于 2019-12-11 02:02:22
问题 I am using redux-form v6.0.1 . Right now, my use-case involves creating a form where: Errors are only displayed onSubmit , when submitFailed prop is true . When the user goes back to fix the errors, the errors go away, and don't redisplay until the next time onSubmit is called. My current solution involves setting touchOnBlur: false , and having my error message display when touched && error . redux-form touches every field when onSubmit is triggered, so I add logic to every field to set

Redux Form - Not able to type anything in input

会有一股神秘感。 提交于 2019-12-11 00:32:30
问题 Hi I have upgraded to redux-form version 6.0.0 recently. And I am facing an issue like I am not able to type anything in the text field. P.S I am also using Reactintl. I am using compose to aggregate connect, reduxform and intl decorator Here is my code Pastebin 回答1: If I understand correctly, then starting with v6 you should provide extra onBlur and onChange methods for the input in order to update its state. For your stateless component renderInput it could be done like this: const

Redux Form Validation firing on load (UPDATE_SYNC_ERRORS)

风流意气都作罢 提交于 2019-12-10 23:28:43
问题 All required fields have their validation triggered by UPDATE_SYNC_ERRORS on load of the form component. I don't think this is a bug I believe it to be a code issue (as it used to work - although I have recently updated) So my question is - What could cause UPDATE_SYNC_ERRORS to fire at this stage? The field also has no value ( undefined ) yet passes through my function and fires an error as 'Required' like when a field has been touched. export const required = value => value ? undefined :

How to onFocus and onBlur a React/Redux form field that's connected to React Date Picker?

对着背影说爱祢 提交于 2019-12-10 22:48:28
问题 I've got this simple v6 redux-form with an input that renders a custom component that populates its value using react-day-picker. https://github.com/gpbl/react-day-picker I chose react-day-picker over others because it doesn't depend on moment.js and works with my current set up. When I focus the field, I want the datepicker to pop up, but if I click anywhere that's not the datepicker, I want it to disappear. Essentially, I want my React datepicker to work like the jQueryUI one in: https:/