Element: Reset fields does not work without validation rules(even empty works)

Created on 7 Feb 2017  ·  3Comments  ·  Source: ElemeFE/element

ElementUI version

1.1.6

OS/Browsers version

Windows 8/Chrome 56

Vue version

2.1.10

Reproduction Link

http://jsfiddle.net/0bsw8uta/1/

Steps to reproduce

Create any form without validation rules and call resetFields

What is Expected?

The fields should get reset to empty values

What is actually happening?

Nothing happens. The reset works only if there are validation rules attached(even empty dummy ones)

Most helpful comment

Validation rules are not required for resetFields to work. You just need to add the prop attribute on el-form-item: http://jsfiddle.net/0bsw8uta/2/

All 3 comments

Validation rules are not required for resetFields to work. You just need to add the prop attribute on el-form-item: http://jsfiddle.net/0bsw8uta/2/

Thank you. I thought adding prop needed validation rules. If you don't mind me asking, what is the purpose of the prop field?

https://github.com/ElemeFE/element/blob/dev/packages/form/src/form-item.vue#L151
https://github.com/ElemeFE/element/blob/dev/packages/form/src/form-item.vue#L24
You can see it for yourself :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kingwl picture Kingwl  ·  3Comments

akaylh picture akaylh  ·  3Comments

yorululu picture yorululu  ·  3Comments

FranzSkuffka picture FranzSkuffka  ·  3Comments

no5no6 picture no5no6  ·  3Comments