Functions reference

General

__construct
$form = new Form($form_ID, $layout = 'horizontal', $attr = '', $framework = 'bs4');
setMode
$form->setMode($mode);
setOptions
$form->setOptions($user_options = array());
getOptions
$form->getOptions($options);
setMethod
$form->setMethod($method);
setAction
$form->setAction($url, $add_get_vars = true);
startFieldset
$form->startFieldset($legend = '', $fieldset_attr = '', $legend_attr = '');
endFieldset
$form->endFieldset();
startDependentFields
$form->startDependentFields($parent_field, $show_values[, $inverse = false]);
endDependentFields
$form->endDependentFields();
clear static
Form::clear($form_ID);
registerValues static
Form::registerValues($form_ID);
mergeValues static
Form::mergeValues($form_names_array);
testToken static
Form::testToken($form_ID);

Elements

addInput
$form->addInput($type, $name, $value = '', $label = '', $attr = '');
addTextarea
$form->addTextarea($name, $value = '', $label = '', $attr = '');
addOption
$form->addOption($select_name, $value, $txt, $group_name = '', $attr = '');
addSelect
$form->addSelect($select_name, $label = '', $attr = '', $displayGroupLabels = true);
addCountrySelect
$form->addCountrySelect($select_name, $label = '', $attr = '', $user_options = array());
addTimeSelect
$form->addTimeSelect($select_name, $label = '', $attr = '', $user_options = array());
addRadio
$form->addRadio($group_name, $label, $value, $attr = '');
printRadioGroup
$form->printRadioGroup($group_name, $label = '', $inline = true, $attr = '');
addCheckbox
$form->addCheckbox($group_name, $label, $value, $attr = '');
printCheckboxGroup
$form->printCheckboxGroup($group_name, $label = '', $inline = true, $attr = '');
addBtn
$form->addBtn($type, $name, $value, $text, $attr = '', $btnGroupName = '')
printBtnGroup
$form->printBtnGroup($btnGroupName, $label = '')
addHtml
$form->addHtml($html, $element_name = '', $pos = 'after');

Rendering

render
$form->render([$debug = false, $display = true]);
useLoadJs
$form->useLoadJs($bundle = '');
printIncludes
$form->printIncludes($type, $debug = false, $display = true);
printJsCode
$form->printJsCode($debug = false);

Utilities

groupElements
$form->groupElements($input1, $input2, $input3 = '', $input4 = '');
setCols
$form->setCols($labelsCols, $fieldsCols, $breakpoint = 'sm');
addHelper
$form->addHelper($helper_text, $element_name);
addAddon
$form->addAddon($input_name, $addon_html, $pos);
addHeading
$form->addHeading($heading_html, $heading_tag, $attr);
addIcon
$form->addIcon($input_name, $icon_html, $pos);
buildAlert
Form::buildAlert($content_text, $framework, $type);
centerContent
$form->centerContent($center = true, $stack = false);
startDiv
$form->startDiv($class = '', $id = '');
endDiv
$form->endDiv();
startRow
$form->startRow($additionalClass = '', $id = '');
endRow
$form->endRow();
startCol
$form->startCol($col_number, $breakpoint = 'sm', $additionalClass = '', $id = '');
endCol
$form->endCol();

Plugins

setPluginsUrl
$form->setPluginsUrl($url);
addPlugin
$form->addPlugin($plugin_name, $selector, $js_content = 'default', $js_replacements = '');
addFileUpload
$form->addFileUpload($name, $value = '', $label = '', $attr = '', $fileUpload_config = '', $current_file = '');
addHcaptcha
$form->addHcaptcha($hcaptcha_site_key, $attr);
addRecaptchaV3
$form->addRecaptchaV3($key);

Popover & Modal

popover
$form->popover('#popover-link', $popover_options);
modal
$form->modal('#modal-target');

Email sending

sendMail static
Form::sendMail($options, $smtp_settings = array());