Ant-design: initialValue not changed on props changed

Created on 22 May 2018  ·  3Comments  ·  Source: ant-design/ant-design

- [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.5.3

Environment

浏览器版本

Reproduction link

http://www.baidu.com

Steps to reproduce

                    <div id="div1">
                        pkid:{this.props.pkid}
                    </div>
                    <FormItem
                        {...formItemLayout}
                        label="产品ID"
                        hasFeedback
                    >
                        {getFieldDecorator('pkid', {
                            initialValue:this.props.pkid,
                            rules: [
                                { required: true, message: '产品ID!' },
                            ],
                        })(
                            <Input placeholder="a-10" />
                        )}
                    </FormItem>

What is expected?

initialValue will changed on this.props.pkid changed

What is actually happening?

initialValue is fist seted value

qq 20180522100953
qq 20180522101001

Most helpful comment

handleSubmit= (values) => {
if(this.props.onOk)
{
this.props.onOk(values);
this.props.form.resetFields();
}
}

called this.props.form.resetFields() after form submit resolved my problem

All 3 comments

That is why it is called initial value.

5109

handleSubmit= (values) => {
if(this.props.onOk)
{
this.props.onOk(values);
this.props.form.resetFields();
}
}

called this.props.form.resetFields() after form submit resolved my problem

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ericdai picture ericdai  ·  3Comments

Orbyt picture Orbyt  ·  3Comments

tianyacsdn picture tianyacsdn  ·  3Comments

mineralres picture mineralres  ·  3Comments

PeteAndersen picture PeteAndersen  ·  3Comments