Text Fields
Single-line text inputs with validation for text, email, URL, phone and password formats.
Text fields are the most common form input. Polyform includes five specialized text field variants, each with its own validation and input behavior.
Field Types
textGeneral purpose text input with optional pattern validation
emailEmail address with automatic validation
urlWeb URL with protocol validation
phonePhone number input (format validation via pattern)
passwordPassword input with masked characters
Basic Usage
Add text fields using the fluent builder methods. Each field type has its own convenience method:
app/Models/Survey.php
Available Settings
Validation
All text fields are validated by the TextFieldValidator. You can combine multiple validation rules:
Pattern Validation
The
pattern setting accepts a regular expression (without delimiters) and is only available for the generic text field type. Email, URL and phone fields use their own validation logic. Frontend Behavior
- Email fields show an email keyboard on mobile devices
- URL fields show a URL keyboard with easy access to .com and /
- Phone fields show a numeric keyboard on mobile devices
- Password fields mask input and include a toggle to reveal the password
- All fields show validation errors inline below the input
Security Note
Password fields in Polyform are meant for surveys and feedback forms, not for authentication. Do not use Polyform to collect account passwords. Use Laravel's built-in authentication for that.