Record Class Form

java.lang.Object
java.lang.Record
io.micronaut.views.fields.Form
Record Components:
action - Form Action
method - Form Method. either `get` or `post`
fieldset - Form fields
enctype - how the form-data should be encoded when submitting it to the server
dataturbo - enables Turbo Drive on a form, defaults to not disabled

@Introspected public record Form(@NonNull @NotBlank String action, @NonNull @NotBlank @Pattern(regexp="get|post") String method, @NonNull @NotNull @Valid Fieldset fieldset, @Nullable @Pattern(regexp="application/x-www-form-urlencoded|multipart/form-data|text/plain") String enctype, @Nullable Boolean dataturbo) extends Record
Representation of an HTML form.

When dataturbo is set to false, the form includes the data-turbo="false" attribute, which disables Turbo Drive on links and forms including descendants. See the Turbo Data Attributes documentation for more information.

Since:
4.1.0
Author:
Sergio del Amo
  • Constructor Summary

    Constructors
    Constructor
    Description
    Form(@NonNull @NotBlank String action, @NonNull @NotBlank @Pattern(regexp="get|post") String method, @NonNull @NotNull @Valid Fieldset fieldset, @Nullable @Pattern(regexp="application/x-www-form-urlencoded|multipart/form-data|text/plain") String enctype, @Nullable Boolean dataturbo)
    Creates an instance of a Form record class.
    Form(@NonNull String action, @NonNull Fieldset fieldset)
     
    Form(@NonNull String action, @NonNull Fieldset fieldset, @Nullable String enctype)
     
    Form(@NonNull String action, @NonNull String method, @NonNull Fieldset fieldset)
     
    Form(@NonNull String action, @NonNull String method, @NonNull Fieldset fieldset, @Nullable Boolean dataturbo)
     
    Form(@NonNull String action, @NonNull String method, @NonNull Fieldset fieldset, @Nullable String enctype)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @NonNull @NotBlank String
    Returns the value of the action record component.
    @Nullable Boolean
    Returns the value of the dataturbo record component.
    @Nullable @Pattern(regexp="application/x-www-form-urlencoded|multipart/form-data|text/plain") String
    Returns the value of the enctype record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    @NonNull @NotNull @Valid Fieldset
    Returns the value of the fieldset record component.
    final int
    Returns a hash code value for this object.
    @NonNull @NotBlank @Pattern(regexp="get|post") String
    Returns the value of the method record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Form

      public Form(@NonNull @NonNull String action, @NonNull @NonNull String method, @NonNull @NonNull Fieldset fieldset, @Nullable @Nullable Boolean dataturbo)
      Parameters:
      action - Form Action
      method - Form Method. either `get` or `post`
      fieldset - Form fields
      dataturbo - Form data-turbo
    • Form

      public Form(@NonNull @NonNull String action, @NonNull @NonNull String method, @NonNull @NonNull Fieldset fieldset, @Nullable @Nullable String enctype)
      Parameters:
      action - Form Action
      method - Form Method. either `get` or `post`
      fieldset - Form fields
      enctype - how the form-data should be encoded when submitting it to the server
    • Form

      public Form(@NonNull @NonNull String action, @NonNull @NonNull String method, @NonNull @NonNull Fieldset fieldset)
      Parameters:
      action - Form Action
      method - Form Method. either `get` or `post`
      fieldset - Form fields
    • Form

      public Form(@NonNull @NonNull String action, @NonNull @NonNull Fieldset fieldset)
      Parameters:
      action - Form Action
      fieldset - Form fields
    • Form

      public Form(@NonNull @NonNull String action, @NonNull @NonNull Fieldset fieldset, @Nullable @Nullable String enctype)
      Parameters:
      action - Form Action
      fieldset - Form fields
      enctype - how the form-data should be encoded when submitting it to the server
    • Form

      public Form(@NonNull @NotBlank @NonNull @NotBlank String action, @NonNull @NotBlank @Pattern(regexp="get|post") @NonNull @NotBlank @Pattern(regexp="get|post") String method, @NonNull @NotNull @Valid @NonNull @NotNull @Valid Fieldset fieldset, @Nullable @Pattern(regexp="application/x-www-form-urlencoded|multipart/form-data|text/plain") @Nullable @Pattern(regexp="application/x-www-form-urlencoded|multipart/form-data|text/plain") String enctype, @Nullable @Nullable Boolean dataturbo)
      Creates an instance of a Form record class.
      Parameters:
      action - the value for the action record component
      method - the value for the method record component
      fieldset - the value for the fieldset record component
      enctype - the value for the enctype record component
      dataturbo - the value for the dataturbo record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • action

      @NonNull @NotBlank public @NonNull @NotBlank String action()
      Returns the value of the action record component.
      Returns:
      the value of the action record component
    • method

      @NonNull @NotBlank @Pattern(regexp="get|post") public @NonNull @NotBlank @Pattern(regexp="get|post") String method()
      Returns the value of the method record component.
      Returns:
      the value of the method record component
    • fieldset

      @NonNull @NotNull @Valid public @NonNull @NotNull @Valid Fieldset fieldset()
      Returns the value of the fieldset record component.
      Returns:
      the value of the fieldset record component
    • enctype

      @Nullable @Pattern(regexp="application/x-www-form-urlencoded|multipart/form-data|text/plain") public @Nullable @Pattern(regexp="application/x-www-form-urlencoded|multipart/form-data|text/plain") String enctype()
      Returns the value of the enctype record component.
      Returns:
      the value of the enctype record component
    • dataturbo

      @Nullable public @Nullable Boolean dataturbo()
      Returns the value of the dataturbo record component.
      Returns:
      the value of the dataturbo record component