pub trait FormControlElement: HtmlElement {
// Provided methods
fn disabled(&self) -> bool { ... }
fn set_disabled(&self, disabled: bool) { ... }
fn name(&self) -> String { ... }
fn set_name(&self, name: impl Into<String>) { ... }
fn form_id(&self) -> Option<String> { ... }
fn set_form_id(&self, form_id: impl Into<String>) { ... }
fn required(&self) -> bool { ... }
fn set_required(&self, required: bool) { ... }
fn check_validity(&self) -> bool { ... }
}Expand description
Shared behavior for all form control elements.
Chrome equivalent: HTMLFormControlElement.
Every form control (button, input, select, textarea) implements this.
All methods have default implementations that read/write attributes.
Provided Methods§
Sourcefn disabled(&self) -> bool
fn disabled(&self) -> bool
Whether this control is disabled.
Disabled controls don’t receive events and are excluded from
form submission. Chrome: HTMLFormControlElement::IsDisabledFormControl().
fn set_disabled(&self, disabled: bool)
fn set_name(&self, name: impl Into<String>)
Sourcefn form_id(&self) -> Option<String>
fn form_id(&self) -> Option<String>
The ID of the associated <form> element.
Chrome: HTMLFormControlElement::formOwner() resolves this
to the actual form element. Currently returns the raw attribute;
form element resolution will be added with the form submission system.
fn set_form_id(&self, form_id: impl Into<String>)
fn set_required(&self, required: bool)
Sourcefn check_validity(&self) -> bool
fn check_validity(&self) -> bool
Whether this control’s value satisfies its constraints.
Chrome: HTMLFormControlElement::checkValidity().
Future: constraint validation API.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.