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>
public class Form
extends BaseComponent<HTMLFormElement, Form>
implements HasItems<HTMLFormElement, Form, FormGroup>, 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 Summary
Modifier and TypeMethodDescriptionWraps the alert in a newFormAlertand inserts it at the top of the form.Adds aFormAlertand inserts it at the top of the form.Adds an item to the component.addActionGroup(FormActionGroup actionGroup) Adds aFormActionGroupto the form.Same asadd(Alert).Same asadd(FormAlert)addFieldGroup(FormFieldGroup fieldGroup) Adds aFormFieldGroupto the form.Same asadd(FormGroup)Same asadd(FormGroup)<T> FormAdds multiple form groups created by the given display function.addSection(FormSection section) Adds aFormSectionto the form.voidclear()Clears all items from the component.voidRemoves all alerts from this form.booleanChecks whether the component contains an item associated with the given identifier.static Formform()Creates a new form component with browser validation disabled.booleanisEmpty()Checks whether the collection of items in the component is empty.Retrieves the item associated with the specified identifier from the component.iterator()Limits the form width to a maximum width.onAdd(AddItemHandler<Form, FormGroup> onAdd) Registers a callback to be invoked whenever a new item is added to the component.onRemove(RemoveItemHandler<Form, FormGroup> onRemove) Registers a callback to be invoked whenever an item is removed from the component.onUpdate(UpdateItemHandler<Form, FormGroup> onUpdate) Registers a callback to be invoked whenever an item is updated in the component.voidremoveItem(String identifier) Removes an item from the component based on the provided identifier.intsize()Retrieves the total number of items currently contained in the component.that()voidupdateItem(FormGroup item) Updates an existing item in the component.Methods inherited from class BaseComponent
componentType, element, ouiaComponentType, registerComponentMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ElementAttributeMethods
aria, aria, aria, attr, attr, attr, role, roleMethods inherited from interface ElementClassListMethods
classList, classList, css, toggle, toggle, toggleMethods inherited from interface ElementConsumerMethods
apply, runMethods inherited from interface ElementContainerMethods
add, add, add, add, addAll, addAll, addAll, addAll, addAll, addAllMethods inherited from interface ElementEventMethods
on, on, onMethods inherited from interface ElementIdMethods
id, uniqueIdMethods inherited from interface ElementQueryMethods
closest, querySelector, querySelectorAllMethods inherited from interface HasItems
items, replaceItemElement, updateItem, updateItemMethods inherited from interface HTMLElementAttributeMethods
titleMethods inherited from interface HTMLElementDataMethods
data, dataMethods inherited from interface HTMLElementVisibilityMethods
hiddenMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface Modifiers.Horizontal
horizontal, horizontalMethods inherited from interface OuiaSupport
initOuia, initOuia, ouiaId, ouiaSafe, ouiaTransition
-
Method Details
-
form
Creates a new form component with browser validation disabled. -
addItems
Adds multiple form groups created by the given display function.- Specified by:
addItemsin interfaceHasItems<HTMLFormElement, Form, FormGroup>- Type Parameters:
T- the type of the items in the iterable- Parameters:
items- the iterable collection of items to be addeddisplay- the function used to transform each item into a subcomponent- Returns:
- the builder instance after adding the items
-
addItem
Same asadd(FormGroup)- Specified by:
addItemin interfaceHasItems<HTMLFormElement, Form, FormGroup>- Parameters:
item- the item to be added- Returns:
- the builder instance after adding the item
-
addGroup
Same asadd(FormGroup) -
add
-
addAlert
Same asadd(Alert). Convenience shortcut that wraps the alert in aFormAlert. -
add
-
addAlert
Same asadd(FormAlert) -
add
-
addSection
Adds aFormSectionto the form. -
addFieldGroup
Adds aFormFieldGroupto the form. -
addActionGroup
Adds aFormActionGroupto the form. -
limitWidth
Limits the form width to a maximum width. Adds.invalid reference
modifier(limitWidth)
-
that
- Specified by:
thatin interfaceTypedBuilder<HTMLFormElement, Form>
-
onAdd
Description copied from interface:HasItemsRegisters a callback to be invoked whenever a new item is added to the component.- Specified by:
onAddin interfaceHasItems<HTMLFormElement, Form, FormGroup>- Parameters:
onAdd- aAddItemHandlerthat takes the builder instance and the item being added as arguments- Returns:
- the builder instance after adding the callback
-
onUpdate
Description copied from interface:HasItemsRegisters a callback to be invoked whenever an item is updated in the component.- Specified by:
onUpdatein interfaceHasItems<HTMLFormElement, Form, FormGroup>- Parameters:
onUpdate- aUpdateItemHandlerthat 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
Description copied from interface:HasItemsRegisters a callback to be invoked whenever an item is removed from the component.- Specified by:
onRemovein interfaceHasItems<HTMLFormElement, Form, FormGroup>- Parameters:
onRemove- aRemoveItemHandlerthat takes the component and the item being removed as arguments- Returns:
- the builder instance after adding the callback
-
iterator
-
size
-
isEmpty
-
contains
Description copied from interface:HasItemsChecks whether the component contains an item associated with the given identifier.- Specified by:
containsin interfaceHasItems<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
Description copied from interface:HasItemsRetrieves the item associated with the specified identifier from the component.- Specified by:
itemin interfaceHasItems<HTMLFormElement, Form, FormGroup>- Parameters:
identifier- the identifier of the item to be retrieved- Returns:
- the item associated with the given identifier, or
nullif no item is found
-
updateItem
Description copied from interface:HasItemsUpdates an existing item in the component.- Specified by:
updateItemin interfaceHasItems<HTMLFormElement, Form, FormGroup>- Parameters:
item- the item to be updated
-
removeItem
Description copied from interface:HasItemsRemoves an item from the component based on the provided identifier.- Specified by:
removeItemin interfaceHasItems<HTMLFormElement, Form, FormGroup>- Parameters:
identifier- the identifier of the item to be removed
-
clear
public void clear()Description copied from interface:HasItemsClears 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:
clearin interfaceHasItems<HTMLFormElement, Form, FormGroup>
-
clearAlerts
public void clearAlerts()Removes all alerts from this form.
-