Advanced form builder with document upload, CSV processing, and validation
The Form component is a powerful, declarative form builder that handles various input types including text fields, document uploads, and CSV processing. It automatically manages file uploads, validation, and submission with built-in error handling.
Text elements support various formats and styling options:
Handle PDF and ZIP file uploads with automatic processing:
Process CSV files and extract data:
Array of form elements defining the structure and validation rules.
Callback function called when form is successfully submitted.
The onSubmit
callback receives a results object with the following data types:
Text inputs return their string values.
Single document uploads return an object with id
and fileName
.
Multiple document uploads return an array of document objects.
CSV uploads return an array of objects, one per row, with column headers as keys.
The Form component includes built-in error handling for file uploads and validation:
Upload Failures: If any file uploads fail, the form will display specific error messages and prevent submission until resolved.
Network Issues: Temporary network issues are automatically retried. Persistent failures will show user-friendly error messages.
File Size Limits: Large files are automatically handled, but consider breaking very large ZIP files into smaller chunks for better user experience.
The Form component integrates seamlessly with the SampleHC workflow system:
useTaskState
to persist form data across workflow steps