Class Form

All Implemented Interfaces:
Iterable<FormGroup>, ElementAttributeMethods<HTMLFormElement, Form>, ElementClassListMethods<HTMLFormElement, Form>, ElementConsumerMethods<HTMLFormElement, Form>, ElementContainerMethods<HTMLFormElement, Form>, ElementEventMethods<HTMLFormElement, Form>, ElementIdMethods<HTMLFormElement, Form>, ElementQueryMethods<HTMLFormElement>, HTMLElementAttributeMethods<HTMLFormElement, Form>, HTMLElementDataMethods<HTMLFormElement, Form>, HTMLElementStyleMethods<HTMLFormElement, Form>, HTMLElementVisibilityMethods<HTMLFormElement, Form>, IsElement<HTMLFormElement>, TypedBuilder<HTMLFormElement, Form>, Component, HasItems<HTMLFormElement, Form, FormGroup>, OuiaSupport<HTMLFormElement, Form>, Modifiers.Horizontal<HTMLFormElement, Form>

A form is a group of elements used to collect information from a user in a variety of contexts, including in a modal, in a wizard, or on a page. Use cases for forms include tasks reliant on user-inputted information for completion like logging in, registering, configuring settings, or completing surveys.
See Also:
  • Method Details

    • form

      public static Form form()
      Creates a new form component with browser validation disabled.
    • addItems

      public <T> Form addItems(Iterable<T> items, Function<T, FormGroup> display)
      Adds multiple form groups created by the given display function.
      Specified by:
      addItems in interface HasItems<HTMLFormElement, Form, FormGroup>
      Type Parameters:
      T - the type of the items in the iterable
      Parameters:
      items - the iterable collection of items to be added
      display - the function used to transform each item into a subcomponent
      Returns:
      the builder instance after adding the items
    • addItem

      public Form addItem(FormGroup item)
      Specified by:
      addItem in interface HasItems<HTMLFormElement, Form, FormGroup>
      Parameters:
      item - the item to be added
      Returns:
      the builder instance after adding the item
    • addGroup

      public Form addGroup(FormGroup group)
    • add

      public Form add(FormGroup item)
      Description copied from interface: HasItems
      Adds an item to the component.
      Specified by:
      add in interface HasItems<HTMLFormElement, Form, FormGroup>
      Parameters:
      item - the item to be added to the component
      Returns:
      the builder instance after the item has been added
    • addAlert

      public Form addAlert(Alert alert)
      Same as add(Alert). Convenience shortcut that wraps the alert in a FormAlert.
    • add

      public Form add(Alert alert)
      Wraps the alert in a new FormAlert and inserts it at the top of the form.
    • addAlert

      public Form addAlert(FormAlert alert)
    • add

      public Form add(FormAlert alert)
      Adds a FormAlert and inserts it at the top of the form.
    • addSection

      public Form addSection(FormSection section)
      Adds a FormSection to the form.
    • addFieldGroup

      public Form addFieldGroup(FormFieldGroup fieldGroup)
      Adds a FormFieldGroup to the form.
    • addActionGroup

      public Form addActionGroup(FormActionGroup actionGroup)
      Adds a FormActionGroup to the form.
    • limitWidth

      public Form limitWidth()
      Limits the form width to a maximum width. Adds
      invalid reference
      modifier(limitWidth)
      .
    • that

      public Form that()
      Specified by:
      that in interface TypedBuilder<HTMLFormElement, Form>
    • onAdd

      public Form onAdd(AddItemHandler<Form, FormGroup> onAdd)
      Description copied from interface: HasItems
      Registers a callback to be invoked whenever a new item is added to the component.
      Specified by:
      onAdd in interface HasItems<HTMLFormElement, Form, FormGroup>
      Parameters:
      onAdd - a AddItemHandler that takes the builder instance and the item being added as arguments
      Returns:
      the builder instance after adding the callback
    • onUpdate

      public Form onUpdate(UpdateItemHandler<Form, FormGroup> onUpdate)
      Description copied from interface: HasItems
      Registers a callback to be invoked whenever an item is updated in the component.
      Specified by:
      onUpdate in interface HasItems<HTMLFormElement, Form, FormGroup>
      Parameters:
      onUpdate - a UpdateItemHandler that takes the component, the previous state of the item, and the updated state of the item as arguments
      Returns:
      the builder instance after adding the callback
    • onRemove

      public Form onRemove(RemoveItemHandler<Form, FormGroup> onRemove)
      Description copied from interface: HasItems
      Registers a callback to be invoked whenever an item is removed from the component.
      Specified by:
      onRemove in interface HasItems<HTMLFormElement, Form, FormGroup>
      Parameters:
      onRemove - a RemoveItemHandler that takes the component and the item being removed as arguments
      Returns:
      the builder instance after adding the callback
    • iterator

      public Iterator<FormGroup> iterator()
      Specified by:
      iterator in interface Iterable<FormGroup>
    • size

      public int size()
      Description copied from interface: HasItems
      Retrieves the total number of items currently contained in the component.
      Specified by:
      size in interface HasItems<HTMLFormElement, Form, FormGroup>
      Returns:
      the number of items contained in the component
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: HasItems
      Checks whether the collection of items in the component is empty.
      Specified by:
      isEmpty in interface HasItems<HTMLFormElement, Form, FormGroup>
      Returns:
      true if the component contains no items; false otherwise
    • contains

      public boolean contains(String identifier)
      Description copied from interface: HasItems
      Checks whether the component contains an item associated with the given identifier.
      Specified by:
      contains in interface HasItems<HTMLFormElement, Form, FormGroup>
      Parameters:
      identifier - the identifier of the item to be checked
      Returns:
      true if the component contains an item associated with the provided identifier, false otherwise
    • item

      public FormGroup item(String identifier)
      Description copied from interface: HasItems
      Retrieves the item associated with the specified identifier from the component.
      Specified by:
      item in interface HasItems<HTMLFormElement, Form, FormGroup>
      Parameters:
      identifier - the identifier of the item to be retrieved
      Returns:
      the item associated with the given identifier, or null if no item is found
    • updateItem

      public void updateItem(FormGroup item)
      Description copied from interface: HasItems
      Updates an existing item in the component.
      Specified by:
      updateItem in interface HasItems<HTMLFormElement, Form, FormGroup>
      Parameters:
      item - the item to be updated
    • removeItem

      public void removeItem(String identifier)
      Description copied from interface: HasItems
      Removes an item from the component based on the provided identifier.
      Specified by:
      removeItem in interface HasItems<HTMLFormElement, Form, FormGroup>
      Parameters:
      identifier - the identifier of the item to be removed
    • clear

      public void clear()
      Description copied from interface: HasItems
      Clears all items from the component. This method removes any existing items within the component, leaving it empty. Any associated or registered callbacks related to the removal of items may be invoked as part of this operation.
      Specified by:
      clear in interface HasItems<HTMLFormElement, Form, FormGroup>
    • clearAlerts

      public void clearAlerts()
      Removes all alerts from this form.