Getting started
Abstracts Class
Advanced
Modules
Expressions
Extensions
Form
List
Model
Related Content
Getting Started with Forms
Revision: 2025/10/18
This tutorial will guide you through creating forms in MilkAdmin. You can create forms automatically starting from the Model with the Builder or manage them manually with the framework classes.
FormBuilder
The fastest way to create forms in MilkAdmin is to use the FormBuilder, which automatically generates form fields from the Model structure.
Basic Example
Starting from an already configured model, you can create a complete form simply by writing:
use Builders\FormBuilder;
use App\{Response, Abstract\AbstractModule};
class ProductModule extends AbstractModule {
#[RequestAction('edit')]
public function actionEdit() {
$form = FormBuilder::create($this->model)->getForm();
Response::render($form);
}
}
- All Model fields
- Automatic validation
- Save button
- CSRF token handling
- Saving for new or modified records
To learn more about creating forms with the FormBuilder, consult the complete documentation at FormBuilder Class Documentation
Under the Hood
Behind the Form Builder there is a complete and accessible system for creating forms and validating data...
All of this part is also accessible separately and is documented in detail in the Forms category:
→ Introduction to Form Creation
Next Steps
To learn more:
- FormBuilder Class Documentation - Complete FormBuilder documentation
- Field Management - Advanced field management
- Form Validation - Custom validation
- Conditional Visibility - Show/hide fields dynamically
- Manual Form System - Manual system for complex forms