diff --git a/packages/components/src/internal/form.ts b/packages/components/src/internal/form.ts index 5dd9744a8..6ebf07f1f 100644 --- a/packages/components/src/internal/form.ts +++ b/packages/components/src/internal/form.ts @@ -122,7 +122,7 @@ export class FormControlController implements ReactiveController { } if (this.host.hasUpdated) { - this.setValidity(this.host.validity.valid); + this.setValidity(this.host?.validity!.valid); } } @@ -347,7 +347,7 @@ export class FormControlController implements ReactiveController { */ updateValidity() { const host = this.host; - this.setValidity(host.validity.valid); + this.setValidity(host?.validity!.valid); } /** diff --git a/packages/components/src/internal/solid-element.ts b/packages/components/src/internal/solid-element.ts index f95835e99..fb0c641fd 100644 --- a/packages/components/src/internal/solid-element.ts +++ b/packages/components/src/internal/solid-element.ts @@ -55,8 +55,8 @@ export interface SolidFormControl extends SolidElement { maxlength?: number; // Form validation properties - readonly validity: ValidityState; - readonly validationMessage: string; + readonly validity?: ValidityState; + readonly validationMessage?: string; // Validation methods checkValidity: () => boolean;