Customize layout of all the fields of a form

With AEM Forms, you can now create a theme and apply it to your form. Theme editor lets you specify the styling of form components in one place. When you create a theme, you specify styling at a component level. For more information on themes, see Themes in AEM Forms.

Create a theme using Theme Editor to customize the layout of all fields in your form. After you create a theme, perform the following steps to apply it to a form:

  1. Open your form in edit mode.
  2. In the edit mode, select a component, then select field-level > Adaptive Form Container, and then select cmppr .
  3. In the sidebar, under Adaptive Form Theme, select the theme you have created using the Theme Editor.

Create a custom field layout

  1. Open CRXDE Lite. The default URL is https://‘[server]:[port]’/crx/de.

  2. Copy a field layout from the /libs/fd/af/layouts/field node (For example, defaultFieldLayout) to the /apps node (For example, /apps/af-field-layout).

  3. Rename the copied node and the defaultFieldLayout.jsp file. For example, errorOnRight.jsp.

  4. Change the value of the qtip and jcr:description properties of the copied node. For example, change the value of the properties to Error On Right

  5. To add new styles and behavior, create a client library in the /etc node.

    For example, at the location /etc/af-field-layout-clientlib, create the node client-library. Add the categories property with value af.field.errorOnRight and style.less file with the following code:

    
    .widgetErrorWrapper {
    
     height: 38px;
     margin: 5px;
    
     .guideFieldWidget{
     width: 60%;
     float: left;
     }
    
     .guideFieldError{
     overflow:hidden;
     width:40%;
     }
    
    }
    
  6. To enhance the appearance and behavior, include the client library created in the layout file (errorOnRight.jsp).

  7. Open the edit dialog box of the field and select the Styling tab. In the Configure Field Layout drop-down box, select the newly created layout, and click OK.

The ErrorOnRight.zip package contains code to show error messages on the right side of fields.

Get File

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