Form Design Patterns

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 12 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Module: Design and Develop AOT Elements

Section: Forms Development

Lesson Title: Form Design Patterns


Introduction: Why Form Design Patterns Matter

In the world of enterprise resource planning (ERP) and complex business applications, the user interface (UI) is more than just a visual layer; it is the primary bridge between the user and the underlying data logic. Form design patterns serve as the architectural blueprint for how data is presented, captured, and validated within an application. When we talk about Application Object Tree (AOT) elements in the context of form development, we are discussing the structured way we organize fields, buttons, and data sources to ensure that business processes are both intuitive and efficient.

Poorly designed forms lead to data entry errors, user frustration, and decreased productivity. Conversely, standardized design patterns allow users to develop a mental model of how the system works. If every "List Page" functions similarly, a user who learns one module will instinctively know how to navigate another. This consistency reduces training time and increases the overall quality of the information stored in your database. By mastering these patterns, you move from simply "placing fields on a screen" to creating a professional-grade user experience that supports complex workflows.


Not read yet

Understanding the Core Architecture of AOT Forms

Before diving into specific patterns, we must understand that forms in an AOT-driven environment are typically metadata-driven. This means the form is not just a collection of pixels, but a set of instructions that tell the runtime engine how to behave. Most modern ERP frameworks utilize a "Pattern-Based" approach, where developers select a pre-defined template for the form. These templates enforce rules about where controls should be placed, how many tabs are allowed, and which action buttons are mandatory.

The Role of Data Sources

Every form pattern begins with a data source. In AOT development, the form's data source is usually linked to a table (or a view). The relationship between the form and the data source dictates the "Form Pattern." For instance, a "Details" pattern requires a single record context, while a "Table" pattern expects to handle a collection of records. If you do not align your pattern choice with your data source complexity, you will encounter validation errors during the build process and a fragmented experience for the end-user.

Callout: Pattern-Based vs. Custom Development In older development environments, developers had total freedom to place controls anywhere. While this allowed for creativity, it resulted in inconsistent UIs. Modern AOT development uses strict pattern-based design. This means the IDE will actually block you from saving a form if it violates the chosen pattern rules. Think of this as "guardrails" that prevent you from creating a messy, unusable interface.


Not read yet

Pattern 1: The Simple List Pattern

The Simple List pattern is the workhorse of any data-driven application. It is used when the primary goal is to display a collection of records that share the same schema. Users expect to see these in a grid format, with the ability to filter, sort, and perform bulk operations.

When to Use

  • Master data tables (e.g., Customer lists, Product catalogs).
  • Lookup tables that do not require complex editing.
  • Read-only reference data.

Implementation Steps

  1. Define the Data Source: Add your primary table to the Data Sources node.
  2. Select the Pattern: In the Form Design properties, select "Simple List."
  3. Add the Action Pane: This is the top area where buttons like "New," "Edit," and "Delete" reside.
  4. Define the Grid: Add a grid control bound to your data source.
  5. Configure Columns: Drag and drop the fields from your data source onto the grid.

Code Example: Configuring a Grid

In your form's init() method, you might need to restrict the initial query to prevent loading millions of records at once.

public void init()
{
    super();

    // Ensure we only load active records by default
    QueryBuildDataSource qbds = this.query().dataSourceTable(tableNum(MyTable));
    qbds.addRange(fieldNum(MyTable, Status)).value(queryValue(Status::Active));
}

Tip: Always ensure your grid columns are ordered logically. The most important identifiers (like Name or ID) should always be in the leftmost columns. Users read from left to right, and hiding the ID in the fifth column is a common UX failure.


Not read yet

Pattern 2: The Details View Pattern

The Details View pattern is used when a user needs to interact with a single record in depth. This is where you perform data entry, update statuses, and view related metadata. Unlike the Simple List, which is broad, the Details View is deep.

Best Practices for Details Views

  • Use Field Groups: Instead of adding individual fields, use table-level field groups. This ensures that if you change the field order in the table, it automatically updates across all forms.
  • Tabbed Navigation: Use tabs to break up the form if there are more than 10-15 fields. Categorize them logically, such as "General," "Financials," and "Logistics."
  • Fast Tabs: If your platform supports it, use "Fast Tabs." These allow users to see a summary of information without clicking into every single tab.

Common Pitfalls

  • Overloading the General Tab: Avoid putting every single field on the first tab. Keep the "General" tab for the most essential information only.
  • Ignoring Validation: Do not rely solely on the UI for data validation. Always implement business logic in the validateWrite() method on the table itself.

Not read yet

Pattern 3: The Dialog/Lookup Pattern

Sometimes, you do not need a full-page form. You need a modal window that pops up to ask for a specific input or to allow the user to select a record from a list. This is the Dialog or Lookup pattern.

Designing an Effective Dialog

  1. Keep it minimal: A dialog should never contain more than 5-7 fields. If it does, you are likely trying to perform a complex update that should happen on a full-page form.
  2. Clear Actions: Always have a primary "OK" button and a "Cancel" button. Use descriptive labels rather than generic terms.
  3. Validation: Since dialogs are often used for quick data entry, ensure that mandatory fields are highlighted immediately.

Code Example: Launching a Dialog

Using a controller class to launch a dialog is a standard practice in AOT development.

public static void main(Args _args)
{
    MyDialogClass dialog = new MyDialogClass();
    if (dialog.prompt())
    {
        // Execute the business logic based on user input
        dialog.run();
    }
}

Callout: Modal vs. Non-Modal Interactions A modal dialog forces the user to complete an action before they can return to the main form. A non-modal (or "modeless") form allows the user to click back and forth between windows. Use modal dialogs for critical inputs where you need to guarantee the user makes a choice. Use modeless forms for reference windows where the user might want to compare data side-by-side.


Not read yet

The Importance of Action Panes

The Action Pane is the "command center" of your form. It is the strip of buttons at the top of the screen that facilitates communication between the user and the system. Standardizing the Action Pane is critical for user adoption.

Structural Guidelines

  • The "New" and "Delete" Buttons: These should always be in the same position on the left-most side of the Action Pane.
  • Grouping: Use "Button Groups" to cluster related actions. For example, all "Report" buttons should be in one group, while "Workflow" buttons should be in another.
  • Icons: Use standard icons. A "plus" sign always means "Create," and a "trash can" or "X" always means "Delete." Do not try to be clever with custom iconography; it confuses users.

The "Command Button" Approach

Avoid writing custom logic directly into the button click events whenever possible. Instead, call methods on the data source or service classes. This keeps your form code clean and makes your logic reusable across different forms.


Not read yet

Handling Complex Data Relationships

In enterprise applications, data is rarely flat. You often deal with headers and lines (a one-to-many relationship). The most common pattern for this is the "Header-Line" pattern.

Header-Line Pattern Structure

  1. The Header: This is usually at the top, showing the master record (e.g., a Sales Order ID, Customer Name, and Date).
  2. The Lines: These are in a grid below the header, showing the details (e.g., specific products, quantities, and prices).
  3. Synchronization: When the user selects a different header record, the lines grid must automatically refresh to show the relevant items.

Implementation Tip

Always use the linkType property on the Data Source. By setting the LinkType to Active, the system automatically handles the synchronization of the child data source whenever the parent record changes. This eliminates the need for you to write manual refresh code in the active() methods of your data sources.


Not read yet

Best Practices for Form Performance

Performance is a key part of the design process. A beautiful form that takes ten seconds to load is a failure. Follow these rules to keep your forms responsive:

  1. Delayed Loading: Use the Delayed property on data sources to prevent the system from fetching data for a tab until the user actually clicks on that tab.
  2. Limit Fields in Grids: Only include fields that are absolutely necessary in your main grid. If a user needs more detail, they can click into the record. Rendering hundreds of columns in a grid is the primary cause of UI lag.
  3. Avoid Heavy Logic in active(): The active() method runs every time a user clicks a row. If you perform database queries or heavy calculations here, the form will feel sluggish. Use caching or asynchronous calls instead.

Common Pitfalls and How to Avoid Them

1. Hardcoding Values

Never hardcode string labels or business logic values (like status codes) directly into the form. Always use Labels (for text) and Enums (for status fields). This makes your application translatable and maintainable.

2. Violating the "Single Responsibility" Principle

Each form should do one thing well. Do not build a "Swiss Army Knife" form that tries to manage customers, inventory, and accounting all in one place. If a form is becoming too complex, it is a sign that you should split it into multiple forms or use a dashboard-style entry point.

3. Ignoring Accessibility

Ensure that your forms are navigable via the keyboard. Users should be able to tab through fields in a logical order, and every button should have an "Alt" text or label that describes its function. This is not just for compliance; it is for efficiency. Power users often prefer keyboard-only navigation.

4. Over-using Popups

While dialogs are useful, forcing a user to click "OK" for every minor action is tedious. Consider using "Inline Editing" for simple tasks where the user can change a value directly in the grid and save it with a single master "Save" button.


Not read yet

Comparison: Form Design Patterns

Pattern Primary Goal Complexity User Interaction
Simple List Data Overview Low Grid-centric, filtering
Details View Data Entry High Tabbed, deep editing
Header-Line Transactional High Master-Detail sync
Dialog Quick Input Low Modal, temporary
Dashboard Navigation Low Tiles, links, KPIs

Advanced UI Concepts: Fast Tabs and Grouping

As you advance in your AOT development journey, you will find that the way you group data defines the professional quality of your work.

Using Field Groups

Table-level field groups are one of the most underutilized features in AOT development. By defining a group on the table (e.g., "AddressGroup"), you can drag that entire group onto a form. If you later add a new field to that group on the table, it automatically appears on every form using that group. This is the definition of "Single Source of Truth."

Fast Tabs

Fast Tabs are a specific implementation of the Details View pattern. They allow users to expand and collapse sections of a form. This is ideal for forms with a high density of information. When designing with Fast Tabs, ensure that you put the most critical information in the first two tabs, as these are the ones most likely to be visible without scrolling.

Warning: Do not nest tabs within tabs. This is a common design error that creates a "labyrinth" interface. If you find yourself needing to create a sub-tab, it is time to rethink your form structure. Consider using a separate "Details" form that opens in a new window instead.


Not read yet

Step-by-Step: Creating a New Form from Scratch

Let's walk through the creation of a standard "Customer Feedback" form to see these concepts in action.

Step 1: Create the AOT Element Right-click your project, select "New Item," and choose "Form." Name it FeedbackEntryForm.

Step 2: Add the Data Source Drag your FeedbackTable from the AOT into the "Data Sources" node of your form. Ensure the Table property is set to FeedbackTable.

Step 3: Define the Design Pattern Right-click the "Design" node. Choose "Apply Pattern" and select "Details Transactional." This will automatically create the skeleton structure (Header/Line components).

Step 4: Configure the Action Pane Add an ActionPane control. Inside it, add an ActionPaneTab. Inside that, add a ButtonGroup. Add standard buttons like "New," "Save," and "Delete." Link these to the Command property (e.g., Command::New).

Step 5: Layout the Fields Create a Tab control. Create a TabPage named "General." Drag your table fields into this page. Group them into a Group control to ensure proper padding and alignment.

Step 6: Add Validation Logic In the FeedbackTable (not the form), override the validateWrite() method to ensure that the "Comments" field is not empty if the "Rating" is below 3 stars.

public boolean validateWrite()
{
    boolean ret = super();

    if (this.Rating < 3 && !this.Comments)
    {
        ret = checkFailed("Comments are required for ratings below 3.");
    }

    return ret;
}

Step 7: Final Polish Set the Caption property of the form to something human-readable, like "Customer Feedback Entry." Save and build.


Not read yet

Ensuring Consistency with Style Guides

Every organization should have a UI style guide. If you are working on a large-scale project, ensure that you are following the naming conventions and design standards of the platform you are developing for.

Checklist for Quality Assurance

  • Do all buttons have standard labels?
  • Is the tab order correct (pressing "Tab" moves through fields in the expected sequence)?
  • Are all mandatory fields marked with an asterisk?
  • Is the form responsive (does it look okay on different screen resolutions)?
  • Did you use standard system labels (e.g., @SYS12345) instead of hardcoded strings?
  • Have you tested the form with a keyboard-only workflow?

Troubleshooting Common Issues

The "Form Not Saving" Problem

If your data is not saving, check the SaveRecord property on your button and the AutoDeclaration property on your data source. Often, the issue is that the form is not properly bound to the data source or that the data source is set to ReadOnly.

The "Slow Form" Problem

If your form takes a long time to open, look at the init() method. Are you doing a select statement on a large table without an index? Always ensure that your form's query is backed by an index. If you are calculating values on the fly, consider moving those calculations to a batch job that runs overnight, rather than calculating them every time the form opens.

The "UI Flicker" Problem

Flickering often happens when you have code in the active() method that refreshes the entire form. Use this.dataSource().refresh() instead of this.research() where possible, as refresh() only updates the current record, whereas research() triggers a full database trip.


Not read yet

Summary and Key Takeaways

Mastering form design patterns is about moving from "making it work" to "making it professional." By adhering to these standards, you create a stable, predictable, and efficient environment for your users.

Key Takeaways

  1. Prioritize Patterns: Always choose a pre-defined AOT form pattern. This provides consistency and ensures your form meets platform standards.
  2. Logic Separation: Keep business logic on the table or in service classes. Your form should only be responsible for display and user interaction.
  3. Data Source Efficiency: Use LinkType, Delayed loading, and proper indexing to ensure your forms remain performant even as your database grows.
  4. Consistency is King: Use standard Action Pane layouts and iconography. Users should never have to guess what a button does.
  5. Focus on the User: Design for the "happy path" first, but never ignore the edge cases. Use validation to guide the user toward correct data entry rather than just throwing error messages at them.
  6. Accessibility Matters: Keyboard navigation and clear labeling are not optional; they are fundamental requirements for a professional-grade interface.
  7. Maintenance Over Creativity: Resist the urge to build custom UI elements when standard ones will suffice. Standard components are easier to maintain, document, and upgrade when the platform evolves.

By focusing on these areas, you ensure that your form development is not just a coding task, but a contribution to the overall usability and reliability of the enterprise system. Always remember that the best code is the code that the user never has to think about because it just works exactly as they expect.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.