Reset native elements if reset() is called.
This commit is contained in:
13
tp-form.js
13
tp-form.js
@ -168,7 +168,7 @@ class TpForm extends LitElement {
|
||||
// Also go through the form's native elements.
|
||||
for (let i = 0, li = this._nativeElements.length; i < li; i++) {
|
||||
const el = this._nativeElements[i];
|
||||
// Skip native controls that are wrapped by custom elements already registerd (e.g. <era-input><input></era-input>)
|
||||
// Skip native controls that are wrapped by custom elements already registered (e.g. <tp-input><input></tp-input>)
|
||||
if (!this._useValue(el) ||
|
||||
(this._isWrapped(el) && json[el.name])) {
|
||||
continue;
|
||||
@ -255,6 +255,17 @@ class TpForm extends LitElement {
|
||||
item.control.reset();
|
||||
}
|
||||
}
|
||||
|
||||
// Also go through the form's native elements.
|
||||
for (let i = 0, li = this._nativeElements.length; i < li; i++) {
|
||||
const el = this._nativeElements[i];
|
||||
// Skip native controls that are wrapped by custom elements already registered (e.g. <tp-input><input></tp-input>)
|
||||
if (this._isWrapped(el)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
el.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
focusFirstControl() {
|
||||
|
Reference in New Issue
Block a user