phone_box() form()

A phone field with a country flag picker and a formatted number (intl-tel-input), checked in the browser by formvalidation.

form()->phone_box($name = '', $extra = [], $replace = [])

Options

OptionMeaning
$nameDefault phone.
selected, valueThe number; default $replace[name].
(html options)See html()->phone_box().

Example

Not run here: the browser check needs formvalidation 0.6.2, a commercial library the framework does not ship ($.fn.formValidation is undefined). The demo shows the field with that error.

Code

return form(['phone' => '+380441234567'])->phone_box();

Notes

  • Validate the number on the server too; for a plain field use tel() / phone().

See also: html/phone_box, form/html5_inputs, demo:form/boxes/phone_box