Using redux I created a form and I am able to dispatch actions, validations and is working fine without any issues.
(使用redux,我创建了一个表单,并且能够调度动作,验证,并且工作正常,没有任何问题。)
But load data/initialize on to form field(ReduxForm) not populating data but code executed, can anyone help me in fixing the issues or where I am going wrong, code executed fine but the data not populating on the respective form fields(但是将数据加载/初始化到表单字段(ReduxForm)上不会填充数据而是执行了代码,有人可以帮助我解决问题或哪里出错了,代码可以很好地执行但数据没有填充到相应的表单字段上)
import "../../views/CSS/Organization.css";
import { Container, Row, Col } from "react-bootstrap";
import {createOrganization} from "../../store/actions/org_actions"
import {connect} from "react-redux"
import moment from 'moment'
import {Field, reduxForm} from 'redux-form'
class Organization extends Component {
componentDidMount(){
}
renderInputField = (field)=>(
<div class='form-group' >
<div class='oddT-icon-input' >
<input {...field.input} placeholder={`${field.placeHolder}`} class='oddT-text' />
<i class={`${field.icon}`}></i>
</div>
<div class="validation-error">{field.meta.touched?field.meta.error:""}</div>
</div>
)
render() {
return (
<div>
<Row>
<div class='col-sm-6' >
<label htmlFor="fePassword">Organization Name</label>
<Field
name="orgName"
component={this.renderInputField}
placeHolder="Organization Name"
icon="fa fa-user"
/>
</div>
</Row>
);
}
}
function mapStateToProps(state,props){
console.log(state)
return {
success: {orgName:"ARSCCOM"},
initialValues :{orgName:"ARSCCOM"}
}
}
export default reduxForm({
validate,
form: 'Organization',
enableReinitialize : true
})(connect(mapStateToProps,{createOrganization})(Organization))
Thank you so much
(非常感谢)
ask by Nagendra N translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…