Mecha CMS

Mecha CMS blog and documentation.

Class Form

Updated: Sunday, 07 August 2016

HTML form markup constructor.

Added since version 1.1.3.

Tags

Input

Base Input
Form::input($type, $name, $value, $placeholder, $attr, $indent);
Hidden Input
Form::hidden($name, $value, $attr, $indent);
File Input
Form::file($name, $attr, $indent);
Check Box Input
Form::checkbox($name, $value, $check, $text, $attr, $indent);
Radio Input
Form::radio($name, $option, $select, $attr, $indent);
Date Input
Form::date($name, $value, $placeholder, $attr, $indent);
Color Input
Form::color($name, $value, $placeholder, $attr, $indent);
Email Input
Form::email($name, $value, $placeholder, $attr, $indent);
Number Input
Form::number($name, $value, $placeholder, $attr, $indent);
Search Input
Form::search($name, $value, $placeholder, $attr, $indent);
Tel Input
Form::tel($name, $value, $placeholder, $attr, $indent);
Text Input
Form::text($name, $value, $placeholder, $attr, $indent);
Password Input
Form::password($name, $value, $placeholder, $attr, $indent);
Range Input
Form::range($name, $value, $placeholder, $attr, $indent);
URL Input
Form::url($name, $value, $placeholder, $attr, $indent);

Button

Form::button($text, $name, $value, $type, $attr, $indent);

Select Box

Form::select($name, $option, $select, $attr, $indent);

Text Area

Form::textarea($name, $content, $placeholder, $attr, $indent);

Options

ParameterDescription
$typeThe type attribute.
$nameThe name attribute. Add a dot prefix on the name attribute value to automatically disable the form input.
$valueThe value attribute. The value of the $value parameter will be encoded automatically.
$contentThe content of the HTML form input. Especially for <textarea> element. The value of the $content parameter will be encoded automatically.
$placeholderThe placeholder attribute.
$optionFor select boxes, this is used to build the <option> element. Each array key will becomes the option value attribute value, and the array value will becomes the option label. Add a dot prefix on the array key to automatically disable the option. For radio inputs, this is used to build the <input type="radio"> element. Each array key will becomes the radio value attribute value, and the array value will becomes the radio label. Add a dot prefix on the array key to automatically disable the radio.
$checkThe checked attribute value. Only accept boolean value, it can be true or false.
$selectThe selected attribute. Match the $select value with the select box option value or radio input value you want to select.
$textAdd text to the button or add text next to the check box element.
$attrSee [article:class-cell]
$indentSee [article:class-cell]
Donation and Email Subscription