Field element

The field element contains two nested elements: widget and caption.

Widget element

The widget element contains the user interface element for interaction with users. It has three CSS classes:

  • Widget: Every widget has this class.
  • name: All the widgets shipped with AEM contain the widget name class. For custom widgets, the widget developer provides the Widget name class.
  • type: Every widget has a user interface element. This class defines the type of the user interface element.
<!--field with caption-->
<div class="field numericfield NumericField3 ">
     <div class="caption">
        caption content
     </div>
     <div class="widget numericfieldwidget numericInput">
       widget content
     </div>
</div>

<!--field without caption-->
<div class="widget numericfieldwidget numericInput">
   widget content
</div>

Besides the type and name class, the field component also contains an additional CSS class named subtype. A subtype identifies which type of field it is, for example, NumericField, DateField, TextField. You can override the subtype class to modify the styling of all the fields of type, subtype.

CSS classes for different components

ComponentTypeName
PagepageUser-defined name
or
Page<pageNumber> (default)
Content AreacontentareaUser-defined name
SubformsubformUser-defined name
Exclusion GroupexclgroupUser-defined name
DrawdrawUser-defined name
FieldfieldUser-defined name
CaptioncaptionNA
WidgetwidgetThe widget developer defines it (For user-defined widgets see the table in the following section)

CSS classes for different Fields

The AEM Forms Designer supports different types of fields in a form like NumericField, DecimalField, and Date Field. All of these fields in HTML contain the above mentioned CSS classes. They also contain some extra classes depending on the type of field.

Every field has an associated widget representing the UI element. The classes of each field and the widgets associated with each field are listed below.

Field TypeSubtypeWidget NameWidget TypeHTML UI Tag
ButtonNAxfaButtonbuttonfieldwidgetinput type=button
CheckButtoncheckboxfieldXfaCheckBoxcheckboxfieldwidgetinput type=checkbox
DateFielddatefielddateFielddatefieldwidgetinput type=text
DateTimeFieldtextfieldtextFieldtextfieldwidgetinput type=text
DecimalFieldnumericfieldnumericInputnumericfieldwidgetinput type=text
DropDownchoicelistdropDownListWidgetchoicelistwidgetselect
ListBoxchoicelistlistBoxWidgetchoicelistwidgetol
NumericFieldnumericfieldnumericInputnumericfieldwidgetinput type=text
PasswordFieldpasswordfielddefaultWidgetpasswordfieldwidgetinput type=password
RadioButtonradiofieldXfaCheckBoxradiofieldwidgetinput type=radio
TextFieldtextfieldtextFieldtextfieldwidgetinput type=text
TimeFieldtextfieldtextFieldtextfieldwidgetinput type=text

CSS classes for different Draw Elements

You can insert static draw elements like text, and images, using the AEM Forms Designer. For each draw element, a separate CSS class is associated with that element. The list of CSS classes for draw elements is listed below. Every draw element has a draw class associated with it.

Draw TypeCSS class
Texttext
Imageimage
Rectanglerectangle
Lineline

Styling other parts of the form

Besides the appearance of UI components in the HTML form, you can change the style of elements like Inline Errors, Inline Warnings, and fields with validation errors.

Styling Inline Errors

When the validation of a field results in an error, an inline error is displayed when the field in active. To change the style of inline errors, override the CSS ID error-msg.

Styling Inline Warnings

When the validation of a field results in a warning, an inline warning is displayed when the field is active. To change the style of these inline warnings, override the CSS ID warning-msg.

Styling Fields with Validation Errors

When validation for a field fails, the style of the widget changes. This style change is done by applying a CSS class widgetError on the widget component. To modify the default styling, override the widgetError class.

Experience Manager


Espressos & Experience Manager: AEM Forms

Espressos & Experience Manager

Thursday, Mar 6, 7:00 PM UTC

Join Adobe's AEM product team as they highlight AEM Forms' latest innovations, including: the new Gen AI Assistant, Unified Composition with AEM Sites, and new ways to deploy forms through conversations.

Register

Connect with Experience League at Summit!

Get front-row access to top sessions, hands-on activities, and networking—wherever you are!

Learn more