Automated system to create forms:
Input types:
[table-of-content]
Upload
It’s the classic file upload, with parameters such as
- classes, can be a string or an array of strings, represents the additional class names to add to the input.
- label, label for the form input, to be included in a
<label>label<input type="file"></label>form. - accept, either a string of comma separated mimetypes or an array of mimetype strings that will be merged in such a comma separated string. Furter informations found in the official w3 document.
* server-side controls not fully implemented. Will be in a future release, alongside with a error_accept string parameter to contain the error message. - autofocus, boolean, html5 attribute, means that the input has to be focused immediatly on page load. Furter informations found in the official w3 document.
- multiple, boolean, html5 attribute, allows for the upload of multiple files in one input. Furter informations found in the official w3 document.
- required, boolean, html5 attribute, requires the user to provide a value for the input. Furter informations found in the official w3 document.
- error_required, string, error message to be used when required isn’t satisfied on a server-side control.
if (isset($input['label'])){
$output .= ‘<label’;
$output .= $class;
$output .= ‘>’;
$output .= htmlspecialchars($input['label']);
$output .= ‘<input type=”file”‘;
} else {
$output .= ‘<input type=”file”‘;
$output .= $class;
}
$output .= $accept
.$autofocus
.$multiple
.$required
.$size;
$output .= ‘ name=”‘.htmlspecialchars($name).’”‘;
if (isset($input['value'])){
$output .= ‘ value=”‘.htmlspecialchars($input['value']).’”‘;
}
$output .= ‘>’;
if (isset($input['label'])){
$output .= ‘</label>’;
}
$output .= $info;
break;
[/table-of-content]