Arguments
collect a set of arguments from a web clientA powerful component system for collecting and validating user input before executing actions in Project Forge applications. The Arguments component provides a clean, reusable way to gather required parameters from users through web forms with built-in validation and error handling.
Key Features
- Declarative Field Definition: Define fields with types, validation, and defaults
- Automatic Form Generation: Creates properly styled forms from field definitions
- Built-in Validation: Server-side validation with user-friendly error messages
- Type Safety: Proper type handling for different input types (text, numbers, dates, etc.)
- Progressive Enhancement: Works without JavaScript, enhanced with it
- Consistent Styling: Integrates seamlessly with Project Forge’s design system
- Flexible Workflow: Collect arguments first, then execute actions with validated data
How It Works
The Arguments component follows a simple workflow:
- Define Fields: Create a
util.FieldDescsstructure describing your required inputs - Collect Input: Use
util.FieldDescsCollect()to gather and validate user input - Check Completeness: Test if all required fields are present and valid
- Show Form or Execute: Display the form for missing fields, or proceed with the action
Basic Usage
Step 1: Define Your Fields
Create a util.FieldDescs structure that describes the arguments you need:
1 | |
Step 2: Implement Your Controller
Use the arguments in your HTTP handler:
1 | |
Field Definition Reference
Basic Field Properties
1 | |
Supported Field Types
Text Input Types
1 | |
Numeric Input Types
1 | |
Date and Time Types
1 | |
Selection Types
1 | |
Boolean Type
1 | |
Working with Collected Arguments
Accessing Values
1 | |
Validation and Error Handling
1 | |