Skip to content

Address

Viames Marino edited this page Mar 26, 2026 · 3 revisions

Pair framework: Address

Pair\Html\FormControls\Address renders a text input specialized for address entry.

Main behavior

  • Renders <input type="text">.
  • Automatically adds CSS class googlePlacesAutocomplete.
  • Sets size="50" and autocomplete="on".
  • Supports minLength() and maxLength() inherited from FormControl.

Methods

  • render(): string
  • Inherited methods from FormControl: id(), label(), required(), placeholder(), value(), class(), data(), aria(), validate().

Validation

No custom validator is defined. Validation uses FormControl::validate() (required, minLength, maxLength).

Example

$address = (new \Pair\Html\FormControls\Address('shippingAddress'))
    ->label('Shipping address')
    ->placeholder('Via Roma 10, Milano')
    ->required()
    ->minLength(10)
    ->maxLength(255);

echo $address->render();

Notes

Address is still a plain text input. Geocoding/autocomplete behavior depends on frontend JS/CSS integration.

For an explicit Google Maps integration with hidden metadata fields, use GoogleAddress.

See also: FormControl, Text, Form.

Clone this wiki locally