redux-form

form & initialValues properties not recognized with multiple forms in one component (redux-form v7.0.4)

心不动则不痛 提交于 2019-12-05 07:16:54
I'm creating multiple forms within a single component and to initialize them with the redux store I'm defining the form's name attribute in the <form> element, as opposed to within the reduxForm() helper, which was documented here... How to embed the same redux-form multiple times on a page? I'm creating the forms from the 'listing' object and passing it to my components with mapStateToProps() . I'm trying to set the initial values of the form with initialValues={} , but Redux Form is producing the following errors and is asking for the form to be declared in the reduxForm() helper... 1)

How to properly set default values using redux-forms?

爷,独闯天下 提交于 2019-12-05 03:53:34
Using React with redux-forms, I got following component, it's a form where 3 input fields might get values if the query string include the values. I'm using initialize method for setting: initialize({ firstname: query.firstname, lastname: query.lastname, birthday: query.dob }); And that fills the fills, however I got two main issues: The submit button keeps disabled The fields are not editable. I tried to set a fix for the submit button by testing the invalid prop, but didn't work. How can I fix and cope those issues? This is the whole component code: import React, { Component, PropTypes }

Uncaught TypeError: this.props.signinUser is not a function(…)

邮差的信 提交于 2019-12-05 02:16:42
问题 src/actions/index.js import axios from 'axios'; const ROOT_URL = "http://localhost:3090"; export function signinUser({ email, password }){ return function(dispatch){ axios.post(`${ROOT_URL}/signin`, { email, password }); console.log("hey"); } } src/components/auth import React, { Component } from 'react'; import { reduxForm } from 'redux-form'; import * as actions from '../../actions'; class Signin extends Component { handleFormSubmit({ email, password }){ this.props.signinUser({ email,

admin-on-rest, redux-form, and trimming field values

半腔热情 提交于 2019-12-05 01:31:15
问题 This is actually less a question than it is me sharing my technique for trimming field values using this library. I'd read every single posting I could find on the matter on Stack Exchange and elsewhere, and could not find a complete working solution. It took me too much time and some trial and error to figure out. With redux-form you must use the change action creator to reset the field value to the trimmed value. The hard part was finding the right place in the code under the right

Redux Form Typescript Pass Custom Props

浪子不回头ぞ 提交于 2019-12-05 00:33:00
问题 I am trying to pass custom props to my component which is decorated with reduxForm . Also I am very new in Typescript. The first problem is that I can't wrap the decorated component with connect: export default connect(mapStateToProps)( reduxForm({ form: 'myform' })(MyComponent) ) The error: Error:(89, 5) TS2345:Argument of type 'DecoratedComponentClass<any, Partial<ConfigProps<any, {}>>>' is not assignable to parameter of type 'ComponentType<{ addressValue: any; isDeliveryAddress: any;

className in <Field> in Redux Form

谁说我不能喝 提交于 2019-12-04 22:44:43
I've created a redux-form and i want to add className to each Field to customize them with css. The code for each field is: <Form onSubmit={handleSubmit(requestAccountsFilter)}> <FormGroup row> <Field id="symbol" name="symbol" type="text" component={inputField} placeholder="Enter Product Here" /> <Field id="side" name="side" component={inputField} type="select"> <option value={null}>Any</option> <option value="Buy">Buy</option> <option value="Sell">Sell</option> </Field> <Field id="status" name="status" component={inputField} type="select"> <option value={null}>Any</option> <option value=

React Datepicker with redux-form

橙三吉。 提交于 2019-12-04 21:16:05
How to make the react-datepicker bind with redux-form? I have this redux-form field: <Field name="due_date" component={props => <DatePicker {...props} readOnly={true} selected={this.state.due_date} value={this.state.due_date} onChange={this.handleDueDate} /> } /> Whenever i submit the redux form does return an empty object not binding the datepicker's value... my onChange : handleDueDate(date) { this.setState({ due_date: moment(date).format('L') }, () => { // do I need to dispatch and action here to update the redux-form in state tree? }) } you have to make a custom component to validate and

How to use Redux-Form with React-Bootstrap?

霸气de小男生 提交于 2019-12-04 18:17:34
问题 I am trying to use "redux-form": "^6.7.0" with "react-bootstrap": "^0.31.0" My Component renders nicely, but when I press Submit, what I see is an empty object. note: I have tried wrapping the Config with connect first, and as show below, first wraping it with redux-form and then with the from react-redux connect() Configuration.js class Config extends Component { render() { const { ServerPort, UserID, PortNumber, WWWUrl, SourcePath, FMEPath, pickFile, pickFolder, handleSubmit } = this.props;

ReactJS - Redux Form - how to conditionally show/hide element based on radio Field element?

僤鯓⒐⒋嵵緔 提交于 2019-12-04 12:40:41
I'm relatively new to Redux and I have a form that has some radio inputs "Yes" or "No". Basically, I want to conditionally show another element which contains another redux form field, based on that radio input selection. Is there a straight forward to do this? I'm trying to just check the formProps.site_visit value, but I get an error about it being undefined. For the record, I've greatly reduced the amount of code in this component for brevity sake. export class RequestForm extends React.Component { submit(formProps) { const request = { square_footage: formProps.get('square_footage'), site

admin-on-rest, redux-form, and trimming field values

只谈情不闲聊 提交于 2019-12-04 11:47:28
This is actually less a question than it is me sharing my technique for trimming field values using this library. I'd read every single posting I could find on the matter on Stack Exchange and elsewhere, and could not find a complete working solution. It took me too much time and some trial and error to figure out. With redux-form you must use the change action creator to reset the field value to the trimmed value. The hard part was finding the right place in the code under the right conditions to do the trim and fire the action. I tried the normalize method included with redux-form. No. I