<!DOCTYPE html>
<html lang="en">
<head>
<base href="https://html5form.owip.info/">
<meta charset="utf-8">
<title>html5form class ? Our Work In Progress</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="html5form class">
<meta name="keywords" content="html5 form php php7 class">
<meta name="author" content="René Mansveld">
<meta name="robots" content="index,follow">
<meta name="revisit-after" content="-1">
<link rel="stylesheet" href="css/style.min.css">
<script src="https://code.jquery.com/jquery-3.6.1.min.js" integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script>
<script src="js/cookies.js"></script>
<script src="js/common.js"></script>
</head>
<body>
<noscript>
<div id="NoScript" style="margin: 4px auto; padding: 3px 6px; width: 500px; border: 4px solid #E00; font-weight: bold; text-align: center; color: #F00; background-color: #FEEFDA;">
JavaScript ist deactivated!<br />Please activate JavaScript to be able to use the entire functionallity of this website.
</div>
</noscript>
<div id="DarkBackground" class="darkBackground" onclick="closePopup();"></div>
<div id="PopupWindow" class="popupWindow">
<div style="position: absolute; top: -22px; right: -22px; z-index: 220;">
<img src="images/ClosePopup.png" alt="Schließen" onclick="closePopup();" style="cursor: pointer;" />
</div>
<div id="Content"></div>
</div>
<div class="center">
<h1>class.html5form.php</h1>
<h2>The most complete html5 form generator and validator php class</h2>
<p>An easy-to-use php class to display html5 forms with validation both in js (before sending) and php (after sending).</p>
<p>Available field types are:</p>
<ul class="cloud">
<li class="function" data-function="bic">bic</li>
<li class="function" data-function="checkbox">checkbox</li>
<li class="function" data-function="checkboxgroup">checkboxgroup</li>
<li class="function" data-function="color">color</li>
<li class="function" data-function="creditcard">creditcard</li>
<li class="function" data-function="currency">currency</li>
<li class="function" data-function="date">date</li>
<li class="function" data-function="email">email</li>
<li class="function" data-function="file">file</li>
<li class="function" data-function="float">float</li>
<li class="function" data-function="hidden">hidden</li>
<li class="function" data-function="iban">iban</li>
<li class="function" data-function="integer">integer</li>
<li class="function" data-function="ip">ip</li>
<li class="function" data-function="name">name</li>
<li class="function" data-function="password">password</li>
<li class="function" data-function="radio">radio</li>
<li class="function" data-function="radiogroup">radiogroup</li>
<li class="function" data-function="range">range</li>
<li class="function" data-function="select">select</li>
<li class="function" data-function="select">select multiple</li>
<li class="function" data-function="tel">tel</li>
<li class="function" data-function="text">text</li>
<li class="function" data-function="textarea">textarea</li>
<li class="function" data-function="time">time</li>
<li class="function" data-function="url">url</li>
<li class="function" data-function="zipcode">zipcode</li>
<li class="function" data-function="code">code</li>
<li class="function" data-function="button">button</li>
<li class="function" data-function="reset">reset</li>
<li class="function" data-function="submit">submit</li>
</ul>
<h2>Sample contact form (no data saved or used)</h2>
<p>After sending the form, the fields get validated (again if javascript is enabled), and if there are errors, a list of the non-valid fields is returned (on this page they get displayed right below this text)</p>
<?php
include('src/classes/class.html5form.php');
if (isset($_POST['save'])) {
$ret = html5form::checkFormData($_POST);
if (is_array($ret)) {
echo '<pre>Errors = ' . print_r($ret, true) . '</pre>';
}
}
$oForm = new html5form('.');
$oForm->addCode('<div class="left halfWidth">');
$oForm->addNameField('Name *', 'name', $_POST['name'], null, null, true, 'full name, at least 2 words', array(array('function' => 'str_word_count', 'operator' => '>=', 'compare' => 2)));
$oForm->addCode('</div><div class="right halfWidth">');
$oForm->addTelField('Phone number *', 'phone', $_POST['phone'], null, null, true);
$oForm->addCode('</div><div class="clear"></div><div class="left halfWidth">');
$oForm->addEmailField('Email address *', 'email', $_POST['email'], true);
$oForm->addCode('</div><div class="right halfWidth">');
$oForm->addRadioGroup('Gender *', 'gender', array(array('male', 'Male', ($_POST['gender'] == 'male')), array('female', 'Female', ($_POST['gender'] == 'female'))), true, LabelPositions::before, 'description');
$oForm->addCode('</div><div class="clear"></div>');
$oForm->addTextarea('Request *', 'request', $_POST['request'], null, null, true, 'at least 10 words', array(array('function' => 'str_word_count', 'operator' => '>=', 'compare' => 10)), LabelPositions::before, 'high');
$oForm->addCode('<h3 style="margin: 8px 0 4px 0">Location</h3>');
$oForm->addCode('<div class="left halfWidth">');
$oForm->addNumericField('Latitude', 'lat', NumericFieldTypes::float, $_POST['lat']);
$oForm->addCode('</div><div class="right halfWidth">');
$oForm->addNumericField('Longitude', 'lon', NumericFieldTypes::float, $_POST['lon']);
$oForm->addCode('</div>');
$oForm->addCode('<script>
function position(pos) {
document.getElementsByName("lat")[0].value = pos.coords.latitude;
document.getElementsByName("lon")[0].value = pos.coords.longitude;
}
function positionError(error) {
switch (error.code) {
case error.PERMISSION_DENIED:
// alert("Permission denied");
break;
case error.POSITION_UNAVAILABLE:
// alert("Position unavailable");
break;
case error.TIMEOUT:
// alert("Timeout");
break;
case error.UNKNOWN_ERROR:
// alert("Unknown error");
break;
}
getIpLocation();
}
function getIpLocation() {
$.ajax({
url: "http://ip-api.com/json/",
method: "get",
cache: false,
contentType: "json",
processData: false,
success: function(data) {
var geo = $.parseJSON(data);
document.getElementsByName("lat")[0].value = pos.coords.latitude;
document.getElementsByName("lon")[0].value = pos.coords.longitude;
},
error: function() {
alert("Dein aktueller Standort konnte nicht ermittelt werden. Bitte gib ihn selbst so genau wie möglich ein.");
}
});
}
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(position, positionError, {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 10
});
} else {
getIpLocation();
}
</script>');
$oForm->addCode('<h3 style="margin: 8px 0 4px 0">Legal</h3>');
$oForm->addCheckbox('Privacy *', 'privacy', '1', false, true, LabelPositions::before, 'I know my data won\'t be used or saved, it will only be validated and returned to me', 'description');
$oForm->addButton('Send', ButtonTypes::submit, 'save', 'Save', '', '', ' ', 'desktop');
$oForm->addButton('Reset', ButtonTypes::reset, '', 'Cancel');
$oForm->display();
?>
<p>Don't worry, this page, including the stylesheet (both style.scss and style.min.css) are included in the download ;-)</p>
<p>The entire code of this sample contact form: <span class="function" data-function="form-code">form-code</span></p>
</div>
<div class="function-description phpcomment bic">
<div class="line">/**</div>
<div class="line"> * function addBicField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field for bank account BIC values</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment checkbox">
<div class="line">/**</div>
<div class="line"> * function addCheckbox()</div>
<div class="line"> * </div>
<div class="line"> * Ads a label and checkbox field with additional descriptive label</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param bool</span> $checked Is this element preselected</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $descriptiveLabel A descriptive label on the other side of the checkbox</div>
<div class="line"> * <span class="keyword">@param string</span> $descriptiveLabelClass The class name of the descriptive label</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment checkboxgroup">
<div class="line">/**</div>
<div class="line"> * function addCheckboxGroup()</div>
<div class="line"> * </div>
<div class="line"> * Ads a label and checkbox fields with additional descriptive labels</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param array</span> $values Array of checkbox data</div>
<div class="line"> * array(</div>
<div class="line"> * array(</div>
<div class="line"> * <input> The name of the input</div>
<div class="line"> * <value> The value of this checkbox</div>
<div class="line"> * <descriptiveLabel> A descriptive label on the side of the checkbox</div>
<div class="line"> * <checked> Is this checkbox checked</div>
<div class="line"> * <required> Must one radio be selected</div>
<div class="line"> * ), ...</div>
<div class="line"> * )</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $descriptiveLabelClass The class name of the descriptive label</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment color">
<div class="line">/**</div>
<div class="line"> * function addColorField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field for bank account BIC values</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment creditcard">
<div class="line">/**</div>
<div class="line"> * function addCreditCardField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment date">
<div class="line">/**</div>
<div class="line"> * function addDateField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $min The minimum allowed value</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $max The maximum allowed value</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment email">
<div class="line">/**</div>
<div class="line"> * function addEmailField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment file">
<div class="line">/**</div>
<div class="line"> * function addFileField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param array</span> $filters The file type filters</div>
<div class="line"> * Example: array('*.png', '*.jpg', '*.jpeg', '*.gif')</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment hidden">
<div class="line">/**</div>
<div class="line"> * function addHiddenField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a hidden field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment iban">
<div class="line">/**</div>
<div class="line"> * function addIbanField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment ip">
<div class="line">/**</div>
<div class="line"> * function addIpField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment name">
<div class="line">/**</div>
<div class="line"> * function addNameField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $min The minimum allowed length</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $max The maximum allowed length</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> * <span class="keyword">@param string</span> $countryCode The 2 character (ISO 3366-1 alpha-2, https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment currency float integer">
<div class="line">/**</div>
<div class="line"> * function addNumericField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">NumericFieldTypes</span> $type The type name of the input (currency|float|integer)</div>
<div class="line"> * <span class="keyword">@param float</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param float</span>|<span class="keyword">null</span> $min The minimum allowed value</div>
<div class="line"> * <span class="keyword">@param float</span>|<span class="keyword">null</span> $max The maximum allowed value</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment password">
<div class="line">/**</div>
<div class="line"> * function addPasswordField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $min The minimum allowed length</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $max The maximum allowed length</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment radio">
<div class="line">/**</div>
<div class="line"> * function addRadio()</div>
<div class="line"> * </div>
<div class="line"> * Ads a label and radio field with additional descriptive label</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The value of the input</div>
<div class="line"> * <span class="keyword">@param bool</span> $checked Is this element preselected</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $descriptiveLabel A descriptive label on the other side of the radio</div>
<div class="line"> * <span class="keyword">@param string</span> $descriptiveLabelClass The class name of the descriptive label</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment radiogroup">
<div class="line">/**</div>
<div class="line"> * function addRadioGroup()</div>
<div class="line"> * </div>
<div class="line"> * Ads a label and radio fields with additional descriptive labels</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param array</span> $values Array of radio button data</div>
<div class="line"> * array(</div>
<div class="line"> * array(</div>
<div class="line"> * <value> The value of this radio</div>
<div class="line"> * <descriptiveLabel> A descriptive label on the side of the radio</div>
<div class="line"> * <checked> Is this radio checked (only one in the group)</div>
<div class="line"> * ), ...</div>
<div class="line"> * )</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must one radio be selected</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $descriptiveLabelClass The class name of the descriptive label</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment range">
<div class="line">/**</div>
<div class="line"> * function addRange()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and range input</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $min The minimum allowed value</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $max The maximum allowed value</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span> $step The step width</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $descriptiveLabelClass The class name of the descriptive label</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment select">
<div class="line">/**</div>
<div class="line"> * function addSelect()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and select field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param array</span> $options The options for the select (name [option|optgroup], value (optional), text)</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param bool</span> $multiple Is this a multi-select</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment tel">
<div class="line">/**</div>
<div class="line"> * function addTelField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $min The minimum allowed length</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $max The maximum allowed length</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment text">
<div class="line">/**</div>
<div class="line"> * function addTextField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $min The minimum allowed length</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $max The maximum allowed length</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment textarea">
<div class="line">/**</div>
<div class="line"> * function addTextarea()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $min The minimum allowed length</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $max The maximum allowed length</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment time">
<div class="line">/**</div>
<div class="line"> * function addTimeField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $min The minimum allowed value</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $max The maximum allowed value</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment url">
<div class="line">/**</div>
<div class="line"> * function addUrlField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $min The minimum allowed length</div>
<div class="line"> * <span class="keyword">@param</span> <span class="keyword">int</span>|<span class="keyword">null</span> $max The maximum allowed length</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment zipcode">
<div class="line">/**</div>
<div class="line"> * function addZipcodeField()</div>
<div class="line"> * </div>
<div class="line"> * Adds a label and field to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $label The label text to show</div>
<div class="line"> * <span class="keyword">@param string</span> $input The name of the input</div>
<div class="line"> * <span class="keyword">@param string</span>|<span class="keyword">null</span> $value The preset value of the input</div>
<div class="line"> * <span class="keyword">@param bool</span> $required Must this field be non empty</div>
<div class="line"> * <span class="keyword">@param string</span> $placeholder Placeholder text</div>
<div class="line"> * <span class="keyword">@param array</span> $restrictions Additional restrictions to be checked</div>
<div class="line"> * array(</div>
<div class="line"> * array('function' => <Function>, 'operator' => <Operator>, 'compare' => <Compare>),</div>
<div class="line"> * ...</div>
<div class="line"> * )</div>
<div class="line"> * 'function' can be one of [value|strlen|...]</div>
<div class="line"> * 'operator' can be one of [==|===|!=|!==|>|>=|<|<=]</div>
<div class="line"> * 'compare' must be the value to compare against</div>
<div class="line"> * Also non-associative allowed: array(array(<Function>, <Operator>, <Compare>), ...)</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> * <span class="keyword">@param string</span> $className The name of the additional class</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> * <span class="keyword">@param string</span> $countryCode The 2 character (ISO 3366-1 alpha-2, https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment code">
<div class="line">/**</div>
<div class="line"> * function addCode()</div>
<div class="line"> * </div>
<div class="line"> * Adds html code in between of the fields defined before and after the code</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $code The html code to insert</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcomment button reset submit">
<div class="line">/**</div>
<div class="line"> * function addButton()</div>
<div class="line"> * </div>
<div class="line"> * Adds a button to the form</div>
<div class="line"> * </div>
<div class="line"> * <span class="keyword">@param string</span> $value The text to show on the button</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">ButtonTypes</span> $type The type of the button (submit|reset|button)</div>
<div class="line"> * <span class="keyword">@param string</span> $name The name of the button</div>
<div class="line"> * <span class="keyword">@param string</span> $id The id name of the button</div>
<div class="line"> * <span class="keyword">@param string</span> $class The class name of the button</div>
<div class="line"> * <span class="keyword">@param string</span> $additionalCss Additional CSS to the input</div>
<div class="line"> * <span class="keyword">@param string</span> $label If set, adds a label for the buttons (only use on the first|last button)</div>
<div class="line"> * <span class="keyword">@param string</span> $labelClass The name of the class to add to the label</div>
<div class="line"> * <span class="keyword">@param</span> <span class="class">LabelPositions</span> $labelPosition The position of the label relative to the input (before|after)</div>
<div class="line"> */</div>
</div>
<div class="function-description phpcode form-code">
<div class="line"><span class="php"><?php</span></div>
<div class="line"><span class="operator">include</span>(<span class="string">'src/classes/class.html5form.php'</span>);</div>
<div class="line"></div>
<div class="line"><span class="operator">if</span> (<span class="function">isset</span>(<span class="variable">$_POST</span>[<span class="string">'save'</span>])) {</div>
<div class="line"> <span class="variable">$ret</span> = <span class="class">html5form</span>::<span class="function">checkFormData</span>(<span class="variable">$_POST</span>);</div>
<div class="line"> <span class="operator">if</span> (<span class="function">is_array</span>(<span class="variable">$ret</span>)) {</div>
<div class="line"> <span class="function">echo</span> <span class="string">'<pre>Errors = '</span> . <span class="function">print_r</span>(<span class="variable">$ret</span>, <span class="constant">true</span>) . <span class="string">'</pre>'</span>;</div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="variable">$oForm</span> = <span class="constant">new</span> <span class="class">html5form</span>(<span class="string">'.'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addCode</span>(<span class="string">'<div class="left halfWidth">'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addNameField</span>(<span class="string">'Name *'</span>, <span class="string">'name'</span>, <span class="variable">$_POST</span>[<span class="string">'name'</span>], <span class="constant">null</span>, <span class="constant">null</span>, <span class="constant">true</span>, <span class="string">'full name, at least 2 words'</span>, <span class="function">array</span>(<span class="function">array</span>(<span class="string">'function'</span> => <span class="string">'str_word_count'</span>, <span class="string">'operator'</span> => <span class="string">'>='</span>, <span class="string">'compare'</span> => <span class="number">2</span>)));</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addCode</span>(<span class="string">'</div><div class="right halfWidth">'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addTelField</span>(<span class="string">'Phone number *'</span>, <span class="string">'phone'</span>, <span class="variable">$_POST</span>[<span class="string">'phone'</span>], <span class="constant">null</span>, <span class="constant">null</span>, <span class="constant">true</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addCode</span>(<span class="string">'</div><div class="clear"></div><div class="left halfWidth">'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addEmailField</span>(<span class="string">'Email address *'</span>, <span class="string">'email'</span>, <span class="variable">$_POST</span>[<span class="string">'email'</span>], <span class="constant">true</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addCode</span>(<span class="string">'</div><div class="right halfWidth">'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addRadioGroup</span>(<span class="string">'Gender *'</span>, <span class="string">'gender'</span>, <span class="function">array</span>(<span class="function">array</span>(<span class="string">'male'</span>, <span class="string">'Male'</span>, (<span class="variable">$_POST</span>[<span class="string">'gender'</span>] == <span class="string">'male'</span>)), <span class="function">array</span>(<span class="string">'female'</span>, <span class="string">'Female'</span>, (<span class="variable">$_POST</span>[<span class="string">'gender'</span>] == <span class="string">'female'</span>))), <span class="constant">true</span>, <span class="class">LabelPositions</span>::before, <span class="string">'description'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addCode</span>(<span class="string">'</div><div class="clear"></div>'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addTextarea</span>(<span class="string">'Request *'</span>, <span class="string">'request'</span>, <span class="variable">$_POST</span>[<span class="string">'request'</span>], <span class="constant">null</span>, <span class="constant">null</span>, <span class="constant">true</span>, <span class="string">'at least 10 words'</span>, <span class="function">array</span>(<span class="function">array</span>(<span class="string">'function'</span> => <span class="string">'str_word_count'</span>, <span class="string">'operator'</span> => <span class="string">'>='</span>, <span class="string">'compare'</span> => <span class="number">10</span>)), <span class="class">LabelPositions</span>::before, <span class="string">'high'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addCode</span>(<span class="string">'<h3 style="margin: 8px 0 4px 0">Location</h3>'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addCode</span>(<span class="string">'<div class="left halfWidth">'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addNumericField</span>(<span class="string">'Latitude'</span>, <span class="string">'lat'</span>, <span class="class">NumericFieldTypes</span>::float, <span class="variable">$_POST</span>[<span class="string">'lat'</span>]);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addCode</span>(<span class="string">'</div><div class="right halfWidth">'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addNumericField</span>(<span class="string">'Longitude'</span>, <span class="string">'lon'</span>, <span class="class">NumericFieldTypes</span>::float, <span class="variable">$_POST</span>[<span class="string">'lon'</span>]);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addCode</span>(<span class="string">'</div>'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addCode</span>(<span class="string">'<script></span></div>
<div class="line"><span class="string"> function position(pos) {</span></div>
<div class="line"><span class="string"> document.getElementsByName("lat")[0].value = pos.coords.latitude;</span></div>
<div class="line"><span class="string"> document.getElementsByName("lon")[0].value = pos.coords.longitude;</span></div>
<div class="line"><span class="string"> }</span></div>
<div class="line"><span class="string"> function positionError(error) {</span></div>
<div class="line"><span class="string"> switch (error.code) {</span></div>
<div class="line"><span class="string"> case error.PERMISSION_DENIED:</span></div>
<div class="line"><span class="string"> // alert("Permission denied");</span></div>
<div class="line"><span class="string"> break;</span></div>
<div class="line"><span class="string"> case error.POSITION_UNAVAILABLE:</span></div>
<div class="line"><span class="string"> // alert("Position unavailable");</span></div>
<div class="line"><span class="string"> break;</span></div>
<div class="line"><span class="string"> case error.TIMEOUT:</span></div>
<div class="line"><span class="string"> // alert("Timeout");</span></div>
<div class="line"><span class="string"> break;</span></div>
<div class="line"><span class="string"> case error.UNKNOWN_ERROR:</span></div>
<div class="line"><span class="string"> // alert("Unknown error");</span></div>
<div class="line"><span class="string"> break;</span></div>
<div class="line"><span class="string"> }</span></div>
<div class="line"><span class="string"> getIpLocation();</span></div>
<div class="line"><span class="string"> }</span></div>
<div class="line"><span class="string"> function getIpLocation() {</span></div>
<div class="line"><span class="string"> $.ajax({</span></div>
<div class="line"><span class="string"> url: "http://ip-api.com/json/",</span></div>
<div class="line"><span class="string"> method: "get",</span></div>
<div class="line"><span class="string"> cache: false,</span></div>
<div class="line"><span class="string"> contentType: "json",</span></div>
<div class="line"><span class="string"> processData: false,</span></div>
<div class="line"><span class="string"> success: function(data) {</span></div>
<div class="line"><span class="string"> var geo = $.parseJSON(data);</span></div>
<div class="line"><span class="string"> document.getElementsByName("lat")[0].value = pos.coords.latitude;</span></div>
<div class="line"><span class="string"> document.getElementsByName("lon")[0].value = pos.coords.longitude;</span></div>
<div class="line"><span class="string"> },</span></div>
<div class="line"><span class="string"> error: function() {</span></div>
<div class="line"><span class="string"> alert("Dein aktueller Standort konnte nicht ermittelt werden. Bitte gib ihn selbst so genau wie möglich ein.");</span></div>
<div class="line"><span class="string"> }</span></div>
<div class="line"><span class="string"> });</span></div>
<div class="line"><span class="string"> }</span></div>
<div class="line"><span class="string"> <span class="operator">if</span> (navigator.geolocation) {</span></div>
<div class="line"><span class="string"> navigator.geolocation.getCurrentPosition(position, positionError, {</span></div>
<div class="line"><span class="string"> enableHighAccuracy: true,</span></div>
<div class="line"><span class="string"> timeout: 5000,</span></div>
<div class="line"><span class="string"> maximumAge: 10</span></div>
<div class="line"><span class="string"> });</span></div>
<div class="line"><span class="string"> } else {</span></div>
<div class="line"><span class="string"> getIpLocation();</span></div>
<div class="line"><span class="string"> }</span></div>
<div class="line"><span class="string"></script>');</span></div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addCode</span>(<span class="string">'<h3 style="margin: 8px 0 4px 0">Legal</h3>'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addCheckbox</span>(<span class="string">'Privacy *'</span>, <span class="string">'privacy'</span>, <span class="string">'1'</span>, <span class="constant">false</span>, <span class="constant">true</span>, <span class="class">LabelPositions</span>, <span class="string">'I know my data won\'t be used or saved, it will only be validated and returned to me'</span>, <span class="string">'description'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addButton</span>(<span class="string">'Send'</span>, <span class="class">ButtonTypes</span>::submit, <span class="string">'save'</span>, <span class="string">'Save'</span>, <span class="string">''</span>, <span class="string">''</span>, <span class="string">' '</span>, <span class="string">'desktop'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">addButton</span>(<span class="string">'Reset'</span>, <span class="class">ButtonTypes</span>::reset, <span class="string">''</span>, <span class="string">'Cancel'</span>);</div>
<div class="line"><span class="variable">$oForm</span>-><span class="function">display</span>();</div>
<div class="line"><span class="php">?></span></div>
</div>
<script>
$(document).ready(function() {
$('.function-description').parent().children(':first-child').css({
visibility: 'hidden',
display: 'block'
});
setTimeout(function() {
$('.function-description').css({
visibility: '',
display: ''
});
}, 1000);
})
$('.function').each(function() {
if ($('.function-description.' + $(this).attr('data-function')).length) {
$(this).css({
textDecorationLine: 'underline',
textDecorationStyle: 'dotted',
textUnderlineOffset: '4px',
textDecorationColor: 'red',
cursor: 'pointer'
}).click(function() {
closePopup();
var s = $('.function-description.' + $(this).attr('data-function'));
s.css('display', 'inline-block');
var w = ((s.innerWidth() + 16) + 18); /* width + popup border (2 * 8px) + scrollbar (18px) */
var h = ((s.children().length * 18) + 16); /* num lines * line height (18px) + popup border (2 * 8px) */
s.css('display', '');
showPopup(s.clone(), w, h);
});
}
});
</script>
</body>
</html>
|