Struct FormBuilder

Source
pub struct FormBuilder(/* private fields */);

Implementations§

Source§

impl FormBuilder

Source

pub fn id(self, value: impl AttributeValue<String>) -> Self

Source

pub fn class(self, value: impl AttributeValue<String>) -> Self

Source

pub fn accept_charset(self, value: impl AttributeValue<String>) -> Self

Space-separated character encodings the server accepts. The browser uses them in the order in which they are listed. The default value means the same encoding as the page.

Source

pub fn action(self, value: impl AttributeValue<String>) -> Self

The URI of a program that processes the information submitted via the form.

Source

pub fn autocomplete(self, value: impl AttributeValue<String>) -> Self

Indicates whether input elements can by default have their values automatically completed by the browser. autocomplete attributes on form elements override it on <form>. Possible values:

  • off: The browser may not automatically complete entries. (Browsers tend to ignore this for suspected login forms; see The autocomplete attribute and login fields.)
  • on: The browser may automatically complete entries.
Source

pub fn enctype(self, value: impl AttributeValue<String>) -> Self

If the value of the method attribute is post, enctype is the MIME type of the form submission. Possible values:

  • application/x-www-form-urlencoded: The default value.
  • multipart/form-data: Use this if the form contains <input> elements with type=file.
  • text/plain: Introduced by HTML5 for debugging purposes.

This value can be overridden by formenctype attributes on <button>, <input type="submit">, or <input type="image"> elements.

Source

pub fn method(self, value: impl AttributeValue<String>) -> Self

The HTTP method to submit the form with. Possible values:

  • post: The POST method; form data sent as the request body.
  • get: The GET method; form data appended to the action URL with a ? separator. Use this method when the form has no side-effects.
  • dialog: When the form is inside a <dialog>, closes the dialog on submission.

This value is overridden by formmethod attributes on <button>, <input type="submit">, or <input type="image"> elements.

Source

pub fn novalidate(self, value: impl AttributeValue<bool>) -> Self

Indicates that the form shouldn’t be validated when submitted. If this attribute is not set (and therefore the form is validated), it can be overridden by a formnovalidate attribute on a <button>, <input type="submit">, or <input type="image"> element belonging to the form.

Source

pub fn rel(self, value: impl AttributeValue<String>) -> Self

Creates a hyperlink or annotation depending on the value.

Source

pub fn target(self, value: impl AttributeValue<String>) -> Self

Indicates where to display the response after submitting the form. It is a name/keyword for a browsing context (for example, tab, window, or iframe). The following keywords have special meanings:

  • _self (default): Load into the same browsing context as the current one.
  • _blank: Load into a new unnamed browsing context.
  • _parent: Load into the parent browsing context of the current one. If no parent, behaves the same as _self.
  • _top: Load into the top-level browsing context (i.e., the browsing context that is an ancestor of the current one and has no parent). If no parent, behaves the same as _self.

This value can be overridden by a formtarget attribute on a <button>, <input type="submit">, or <input type="image"> element.

Source§

impl FormBuilder

Source

pub fn on_blur( self, f: impl 'static + FnMut(FocusEvent, HtmlFormElement), ) -> Self

Source

pub fn on_click( self, f: impl 'static + FnMut(MouseEvent, HtmlFormElement), ) -> Self

Source

pub fn on_change(self, f: impl 'static + FnMut(Event, HtmlFormElement)) -> Self

Source

pub fn on_dblclick( self, f: impl 'static + FnMut(MouseEvent, HtmlFormElement), ) -> Self

Source

pub fn on_focusout( self, f: impl 'static + FnMut(FocusEvent, HtmlFormElement), ) -> Self

Source

pub fn on_input( self, f: impl 'static + FnMut(InputEvent, HtmlFormElement), ) -> Self

Source

pub fn on_keydown( self, f: impl 'static + FnMut(KeyboardEvent, HtmlFormElement), ) -> Self

Source

pub fn on_keyup( self, f: impl 'static + FnMut(KeyboardEvent, HtmlFormElement), ) -> Self

Source

pub fn effect(self, f: impl Effect<HtmlFormElement>) -> Self

Source§

impl FormBuilder

Source

pub fn text(self, child: impl Text) -> Self

Source

pub fn child<Child>(self, c: Child) -> Self
where Child: Into<Element>,

Trait Implementations§

Source§

impl Builder for FormBuilder

Source§

impl DomElement for FormBuilder

Source§

impl From<FormBuilder> for Element

Source§

fn from(builder: FormBuilder) -> Self

Converts to this type from the input type.
Source§

impl From<FormBuilder> for ElementBuilder

Source§

fn from(builder: FormBuilder) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.