Class Fieldset


@Marshalled(typeName="fieldset") public class Fieldset extends HtmlElementMixed<Fieldset>
DTO for an HTML <fieldset> element.

The fieldset element groups related form controls together. It provides a visual and semantic grouping mechanism that helps organize complex forms and improves accessibility. The legend element is typically used as the first child to provide a caption for the fieldset.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Simple fieldset with legend Fieldset fieldset1 = fieldset( legend("Personal Information"), input("text").name("firstName").placeholder("First Name"), input("text").name("lastName").placeholder("Last Name") ); // Disabled fieldset Fieldset fieldset2 = fieldset( legend("Disabled Section"), input("text").name("disabledField").value("Cannot edit") ).disabled(true); // Fieldset with custom styling Fieldset fieldset3 = fieldset( legend("Contact Details"), input("email").name("email").placeholder("Email"), input("tel").name("phone").placeholder("Phone") ).class_("form-group");

The following convenience methods are provided for constructing instances of this bean:

See Also:
  • Constructor Details

    • Fieldset

      public Fieldset()
      Creates an empty Fieldset element.
    • Fieldset

      public Fieldset(Object... children)
      Creates a Fieldset element with the specified child nodes.
      Parameters:
      children - The child nodes. Must not be null.
  • Method Details

    • disabled

      public Fieldset disabled(Object value)
      disabled attribute.

      Whether the form control is disabled.

      This attribute uses deminimized values:

      • false - Attribute is not added
      • true - Attribute is added as "disabled"
      • Other values - Passed through as-is
      Parameters:
      value - The new value for this attribute. Typically a Boolean or String. Can be null to unset the attribute.
      Returns:
      This object.
    • form

      public Fieldset form(String value)
      form attribute.

      Associates the fieldset with a form element by specifying the form's ID. This allows the fieldset to be placed outside the form element while still being part of the form.

      The value should match the ID of a form element in the same document.

      Parameters:
      value - The ID of the form element to associate with this fieldset. Can be null to unset the attribute.
      Returns:
      This object.
    • name

      public Fieldset name(String value)
      name attribute.

      Specifies the name of the fieldset. This name can be used to access the fieldset via the form.elements API and for form submission.

      The name should be unique within the form and should not contain spaces or special characters.

      Parameters:
      value - The name of the fieldset for API access and submission. Can be null to unset the attribute.
      Returns:
      This object.