react-redux-form

redux-form is refreshing the page onSubmit

我们两清 提交于 2019-12-07 06:32:10
问题 I have a redux form that when submitted, is causing the entire browser page to refresh which is not desired... What am I doing wrong here to cause the page to refresh on submit? Rate.js import React from 'react'; import RateForm from '../../components/rate/RateForm'; class Rate extends React.Component { handleSubmit(data) { alert('x') console.log('handleSubmit'); console.log(data); } render() { const fields = [ { name: 'execution', type: 'select', options: [ { label: '5', value: '5' }, ], },

Redux Form, Radio Button Fields, how to support variable values?

我的梦境 提交于 2019-12-05 23:37:29
In my react redux form, I have the following: <fieldset className="form-group"> <legend>Radio buttons</legend> {this.props.job_titles.map(jobTitle => ( <div className="form-check" key={jobTitle.id}> <label className="form-check-label"> <Field name="job_title_id" component="input" type="radio" value={jobTitle.id} /> {' '} {jobTitle.title} </label> </div> ))} </fieldset> This renders the radio buttons correctly, but when you click to select a radio button, the radio button never sets as selected. You can't select an option - the form is broken. What's strange is if I update: value={jobTitle.id}

redux-form is refreshing the page onSubmit

谁都会走 提交于 2019-12-05 12:25:46
I have a redux form that when submitted, is causing the entire browser page to refresh which is not desired... What am I doing wrong here to cause the page to refresh on submit? Rate.js import React from 'react'; import RateForm from '../../components/rate/RateForm'; class Rate extends React.Component { handleSubmit(data) { alert('x') console.log('handleSubmit'); console.log(data); } render() { const fields = [ { name: 'execution', type: 'select', options: [ { label: '5', value: '5' }, ], }, ] return ( <div> <RateForm fields={fields} handleSubmit={this.handleSubmit.bind(this)} /> </div> ) } }

Redux-Form update field value from external interaction

核能气质少年 提交于 2019-11-30 12:23:49
I have a redux-form connected to my application state and everything seems to work great. I can fetch data and load it into my form, then submit data and get the metadata I want... However, I have a custom interaction (a color picker) that needs to change the value of a managed Field on the fly. Everything I try will change the screen, but not the redux form state i.e. when I submit the form I just get the original field data and not the new data shown in the form. The version below is passing the field props to the component and trying to use the ColorSelect component state as the field value

Redux-Form update field value from external interaction

情到浓时终转凉″ 提交于 2019-11-29 17:50:34
问题 I have a redux-form connected to my application state and everything seems to work great. I can fetch data and load it into my form, then submit data and get the metadata I want... However, I have a custom interaction (a color picker) that needs to change the value of a managed Field on the fly. Everything I try will change the screen, but not the redux form state i.e. when I submit the form I just get the original field data and not the new data shown in the form. The version below is

How to use React refs to focus a Redux Form field?

微笑、不失礼 提交于 2019-11-29 14:04:41
I am trying to use React refs to focus a Redux-Form Field when it mounts. When I try this.refs.title.getRenderedComponent().focus() in componentDidMount , an error is thrown saying: edit_fund.js:77 Uncaught TypeError: Cannot read property 'getRenderedComponent' of undefined When I console.log this.refs, it is mostly an empty object and sometimes identifies 'title' as being a ref, but it is not dependable. Am I using refs incorrectly? My code is below for reference. componentDidMount = () => { this.refs.title .getRenderedComponent() .focus(); } ... <Field id="title" name="title" component=

How to use React refs to focus a Redux Form field?

可紊 提交于 2019-11-28 07:36:48
问题 I am trying to use React refs to focus a Redux-Form Field when it mounts. When I try this.refs.title.getRenderedComponent().focus() in componentDidMount , an error is thrown saying: edit_fund.js:77 Uncaught TypeError: Cannot read property 'getRenderedComponent' of undefined When I console.log this.refs, it is mostly an empty object and sometimes identifies 'title' as being a ref, but it is not dependable. Am I using refs incorrectly? My code is below for reference. componentDidMount = () => {