Repository navigation
Url
Pair\Html\FormControls\Url renders <input type="url"> with classic required-URL validation when no validation preset is active.
For reusable URL validation, use Form::webUrl(...) or call preset(FormValidationPreset::URL).
render(): stringvalidate(): bool- Inherited methods from FormControl:
required(),minLength(),maxLength(),pattern(),placeholder(),value(),preset().
Without a validation preset, validate() logic is:
- if field is
required, value must passFILTER_VALIDATE_URL - then default
FormControlchecks run (required,minLength,maxLength)
With the url preset active, validation delegates to the shared FormValidationPreset path.
The preset trims the value, requires a hierarchical scheme such as https://, rejects non-empty invalid optional values, and exposes metadata for PairValidation.js.
Required website URL:
$website = (new \Pair\Html\FormControls\Url('website'))
// The preset path also validates non-empty optional values.
->preset(\Pair\Html\FormValidationPreset::URL)
->required()
->placeholder('https://example.com')
->maxLength(255);
if (!$website->validate()) {
// handle invalid URL
}Optional URL constrained to https:
$source = (new \Pair\Html\FormControls\Url('sourceUrl'))
->preset(\Pair\Html\FormValidationPreset::URL)
->pattern('^https://.+$');See also: Email, Text, FormControl, FormValidationPreset, PairValidation.js.
Maintained by Viames Marino — VM Ingegneria · Professional enquiries
Home · Setup · Configuration
Build with Pair 4
- Generator
- Controllers and responses
- Read models
- ActiveRecord and queries
- Forms and validation
- PairUI.js and HTML fragments
APIs and authentication
- API guide and CRUD
- Middleware and rate limits
- Users, sessions, and ACL
- Passkeys and social login
- Native mobile setup
Integrate and operate
- Integrations
- Runtime extensions and adapter keys
- Cache and cache stores
- Logs and observability
- PWA and push
- Packages and distribution
- Upgrade to v4