HTML5 inputs form()

input() with an HTML5 type and a default name: url, color, date, datetime, datetime-local, month, range, search, tel, time, week.

form()->url($name = '', $desc = '', $extra = [], $replace = [])
form()->color($name = '', $desc = '', $extra = [], $replace = [])
form()->date($name = '', $desc = '', $extra = [], $replace = [])
form()->datetime($name = '', $desc = '', $extra = [], $replace = [])
form()->datetime_local($name = '', $desc = '', $extra = [], $replace = [])
form()->month($name = '', $desc = '', $extra = [], $replace = [])
form()->range($name = '', $desc = '', $extra = [], $replace = [])
form()->search($name = '', $desc = '', $extra = [], $replace = [])
form()->tel($name = '', $desc = '', $extra = [], $replace = [])
form()->phone($name = '', $desc = '', $extra = [], $replace = [])
form()->time($name = '', $desc = '', $extra = [], $replace = [])
form()->week($name = '', $desc = '', $extra = [], $replace = [])

Options

OptionMeaning
$nameDefault the type (url, color, date...); phone() is tel named phone.
min, max, stepFor dates, times and range.
show_valuerange(): show the current value next to the slider.
prependurl() prepends url.
(input options)Every option of input().

Example

url
40

Code

return form(['site' => 'https://example.com', 'brand' => '#337ab7', 'volume' => 40])
    ->url('site')
    ->color('brand')
    ->date('start', ['min' => '2026-01-01'])
    ->datetime('ends_at')
    ->datetime_local('meeting')
    ->month('billing_month')
    ->week('sprint')
    ->time('opens', ['step' => 900])
    ->range('volume', ['min' => 0, 'max' => 100, 'show_value' => 1])
    ->search('q')
    ->tel('fax')
    ->phone();

Notes

  • datetime() prints type="datetime", which browsers show as a plain text field; $PROJECT_CONF['form2']['CONF_DATETIME_LOCAL_TYPE'] = true makes it datetime-local (default flips in 4.0). datetime_local() is always datetime-local.
  • Native pickers post ISO values (2026-11-15, 2026-11-15T10:30, 10:30); for a picker with a format and limits see datetime_select().

Bootstrap 3 and 5

range() and color() get form-range and form-control form-control-color under Bootstrap 5, form-control under 3.

See also: form/datetime_select, form/date_box, demo:form/datetime_pickers