diff --git a/package.json b/package.json index d4ca9ea..e4e3074 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tp/tp-form", - "version": "1.0.0", + "version": "1.0.1", "description": "", "main": "tp-form.js", "scripts": { diff --git a/tp-form.js b/tp-form.js index 223c0e0..76eec7b 100644 --- a/tp-form.js +++ b/tp-form.js @@ -250,6 +250,7 @@ class TpForm extends LitElement { for (let i = 0, li = this._origValues.length; i < li; ++i) { const item = this._origValues[i]; item.control.value = this._copyValue(item.value || null, item.control); + item.control.checked = this._copyValue(item.checked || null, item.control); if (typeof item.control.reset === 'function') { item.control.reset(); } @@ -279,6 +280,7 @@ class TpForm extends LitElement { for (let i = 0, li = this._origValues.length; i < li; ++i) { const item = this._origValues[i]; item.value = item.control.value; + item.checked = item.control.checked; } this._snapshot = JSON.stringify(this.serialize()); @@ -295,7 +297,7 @@ class TpForm extends LitElement { } // Store copy of original value in case we want to reset the form. - this._origValues.push({ control: target, value: this._copyValue(target.value, target) }); + this._origValues.push({ control: target, value: this._copyValue(target.value, target), checked: this._copyValue(target.checked, target) }); // Stop propagation of the registration event. // This allows for nested forms. @@ -433,4 +435,4 @@ class TpForm extends LitElement { } } -window.customElements.define('tp-form', TpForm); \ No newline at end of file +window.customElements.define('tp-form', TpForm);