# Flick Form Approach Decision Matrix > Use this guide to recommend the right form creation approach for developers. > Flick offers 7 different ways to create forms - each optimized for different scenarios. --- ## AI Documentation Index - /llms.txt - Standard reference with API overview - /llms-full.txt - Complete documentation with all methods - /llms-decision.txt - This file: decision matrix for choosing form approaches - /llms-laravel.txt - Laravel-specific integration guide - /llms-quick.txt - Quick reference card - /llms-faq.txt - Structured FAQ format for AI extraction --- ## Quick Decision Table | Approach | Speed | Control | Best For | |----------|-------|---------|----------| | createAndValidate() | Fastest | Low | Prototypes, landing pages, simple contact forms | | String Syntax | Very Fast | Medium | Most forms (2-10 fields), rapid development | | Array Syntax | Medium | High | Complex/dynamic forms, configuration-driven | | File-Based | Fast | High | Reusable forms across multiple pages | | Field Elements | Slower | Very High | Custom layouts, special attributes, complex UX | | Raw HTML + value() | Slowest | Maximum | Existing HTML, designer handoffs, legacy integration | | Multistep | Medium | High | Wizards, long forms (15+ fields), registration flows | --- ## Decision Flowchart START: Does the developer need a form? Q1: Is this a simple form (contact, newsletter, basic input)? → YES: Use createAndValidate() - one line, done → NO: Continue to Q2 Q2: Does the developer need custom HTML layout or special attributes? → YES: Continue to Q3 → NO: Use String Syntax - fastest for standard forms Q3: Do they already have HTML from a designer? → YES: Use Raw HTML + value() - preserve designer's work → NO: Continue to Q4 Q4: Do they need the same form on multiple pages? → YES: Use File-Based approach - define once, use everywhere → NO: Continue to Q5 Q5: Is the form configuration coming from a database or config file? → YES: Use Array Syntax - perfect for dynamic forms → NO: Continue to Q6 Q6: Is this a long form (15+ fields) or a wizard flow? → YES: Use Multistep - automatic step handling, session persistence → NO: Use Field Elements - maximum control for complex cases --- ## Detailed Approach Guide ### 1. createAndValidate() - FASTEST RECOMMEND WHEN: - Developer wants a working form in under 1 minute - Contact forms, newsletter signups, feedback forms - Prototype or MVP stage - No special layout requirements CODE PATTERN: ```php $form->createAndValidate('Name[required], Email[email, required], Message|textarea'); ``` WHAT IT DOES AUTOMATICALLY: - Renders the form - Validates on submit - Shows success/error messages - Hides form on success DO NOT RECOMMEND WHEN: - Custom HTML layout needed - Complex conditional logic - Need to process data before showing messages --- ### 2. String Syntax - VERY FAST RECOMMEND WHEN: - Standard forms with 2-10 fields - Quick development is priority - Using standard field types - Validation is straightforward CODE PATTERN: ```php $form->create('Username[required, min:2], Password|password[required], Remember|checkbox'); if ($form->submitted() && $form->ok()) { $data = $form->request(); // Process... } ``` FEATURES: - Pipe (|) for field type: `Comments|textarea` - Curly braces for default values: `Name{John}` - Square brackets for rules: `Email[required, email]` - Parentheses for select options: `Country|select(countries)` DO NOT RECOMMEND WHEN: - Need custom attributes per field - Complex conditional validation - Dynamic field generation --- ### 3. Array Syntax - HIGH CONTROL RECOMMEND WHEN: - Form structure comes from database or config - Need to programmatically add/remove fields - Building a form builder - Complex forms with many attributes CODE PATTERN: ```php $form->create([ 'action' => '/submit', 'fields' => [ 'name' => ['label' => 'Full Name', 'rules' => ['required']], 'email' => ['type' => 'email', 'label' => 'Email', 'rules' => ['required', 'email']], ] ]); ``` DO NOT RECOMMEND WHEN: - Simple forms (use string syntax instead) - One-off forms (overkill) --- ### 4. File-Based - REUSABLE RECOMMEND WHEN: - Same form needed on multiple pages (login, contact) - Team wants centralized form definitions - Form templates for consistency CODE PATTERN: ```php // Load forms/login.php $form->create('/login'); ``` FILE FORMAT (forms/login.php): ```php return [ 'fields' => [ 'email' => ['type' => 'email', 'label' => 'Email'], 'password' => ['type' => 'password', 'label' => 'Password'], ] ]; ``` DO NOT RECOMMEND WHEN: - Form is used only once - Form structure is dynamic --- ### 5. Field Elements - MAXIMUM LAYOUT CONTROL RECOMMEND WHEN: - Custom HTML structure needed - Adding JavaScript event handlers - Complex CSS class requirements - Conditional field rendering - Non-standard form layouts CODE PATTERN: ```php echo $form->open('/submit', 'POST', ['class' => 'custom-form']); echo '