Commit 0b432da4 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Documentation/UsersManual: update form.parameter.submitButtontext

AbstractBuildForm.php, BuildFormBootstrap.php: Implemented alternative button at the bottom of the form.
parent d4ee5482
......@@ -530,12 +530,24 @@ Field: Form.parameter
+------------------------+--------+---------------------------------------------------------------------------------------------------+
| class | string | HTML div with given class, surrounding the whole form. Eg.: class=container-fluid |
+------------------------+--------+---------------------------------------------------------------------------------------------------+
| submitButtonText | string | Show save button, with the <submitButtonText> at the bottom of the form |
+------------------------+--------+---------------------------------------------------------------------------------------------------+
* Example:
* maxVisiblePill = 5
* class = container-fluid
Field: Form.parameter.submitButtonText
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* Optional
* By default this field is empty and a 'submit' button with a Bootstrap glyph 'check' symbol is rendered at the top right corner of the form.
* In case the 'submit' is needed at the bottom of the form, a <submitButtonText> can be specified. This will automatically
render the 'submit' at the bottom without a 'check' glyph symbol. Be sure to uncheck 'ShowButton: Save'
FormElements
------------
* Each *form* contains one or more *FormElement*.
......
......@@ -159,8 +159,6 @@ abstract class AbstractBuildForm {
// <form>
if ($mode === FORM_LOAD) {
$htmlHead = $this->head();
$htmlTail = $this->tail();
$htmlSubrecords = $this->doSubrecords();
}
$filter = $this->getProcessFilter();
......@@ -178,6 +176,13 @@ abstract class AbstractBuildForm {
$recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP);
$htmlElements = $this->elements($recordId, $filter, 0, $json, $modeCollectFe, $htmlElementNameIdZero, $storeUse, $mode);
}
// <form>
if ($mode === FORM_LOAD) {
$htmlTail = $this->tail();
$htmlSubrecords = $this->doSubrecords();
}
$htmlSip = $this->buildHiddenSip($json);
return ($mode === FORM_LOAD) ? $htmlHead . $htmlElements . $htmlSip . $htmlTail . $htmlSubrecords : $json;
......@@ -313,10 +318,6 @@ abstract class AbstractBuildForm {
}
abstract public function tail();
abstract public function doSubrecords();
abstract public function getProcessFilter();
/**
......@@ -435,6 +436,10 @@ abstract class AbstractBuildForm {
abstract public function fillWrapLabelInputNote($label, $input, $note);
abstract public function tail();
abstract public function doSubrecords();
/**
* Create a hidden sip, based on latest STORE_SIP Values. Return complete HTML 'hidden' element.
*
......
......@@ -119,6 +119,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
}
/**
* Build Buttons panel on top right corner of form.
* Simulate Submit Button: http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml
*
* @return string
......@@ -141,7 +142,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
}
// Button: Save
if (Support::findInSet(FORM_BUTTON_SAVE, $this->formSpec['showButton'])) {
if (Support::findInSet(FORM_BUTTON_SAVE, $this->formSpec['showButton']) && $this->formSpec[F_SUBMIT_BUTTON_TEXT] === '') {
$toolTip = 'Save';
if ($this->showDebugInfo) {
......@@ -205,6 +206,8 @@ class BuildFormBootstrap extends AbstractBuildForm {
}
/**
* Creates a button with the given attributes. If there is no $icon given, render the button without glyph.
*
* @param $id
* @param $title
* @param $icon
......@@ -212,7 +215,16 @@ class BuildFormBootstrap extends AbstractBuildForm {
* @return string
*/
private function buildButtonCode($id, $title, $icon, $disabled = '') {
return "<button id='$id' type='button' class='btn btn-default navbar-btn $disabled' " . Support::doAttribute('title', $title) . "><span class='glyphicon $icon'></span></button>";
$element = "<span class='glyphicon $icon'></span>";
$classAdd = "navbar-btn";
if ($icon === '') {
$element = $title;
$classAdd = '';
}
return "<button id='$id' type='button' class='btn btn-default $classAdd $disabled' " . Support::doAttribute('title', $title) . ">$element</button>";
}
/**
......@@ -308,6 +320,19 @@ class BuildFormBootstrap extends AbstractBuildForm {
$formId = $this->getFormId();
// Button Save at bottom of form - only if there is a button text given.
if ($this->formSpec[F_SUBMIT_BUTTON_TEXT] !== '') {
$buttonText = $this->formSpec[F_SUBMIT_BUTTON_TEXT];
$htmlElement = $this->buildButtonCode('save-button', $buttonText, '');
$html .= $this->wrapItem(WRAP_SETUP_LABEL, '');
$html .= $this->wrapItem(WRAP_SETUP_INPUT, $htmlElement);
$html .= $this->wrapItem(WRAP_SETUP_NOTE, '');
$html = $this->wrapItem(WRAP_SETUP_ELEMENT, $html);
}
$html .= '</div> <!--class="tab-content" -->'; // <div class="tab-content">
// $html .= '<input type="submit" value="Submit">';
......
......@@ -434,6 +434,7 @@ const GLYPH_ICON_CLOSE = 'glyphicon-remove';
const F_TABLE_NAME = 'tableName';
const F_REQUIRED_PARAMETER = 'requiredParameter';
const F_SUBMIT_BUTTON_TEXT = 'submitButtonText';
// FORM_ELEMENT_STATI
const FE_MODE_SHOW = 'show';
......
......@@ -351,6 +351,8 @@ class QuickFormQuery {
Support::setIfNotSet($this->formSpec, F_BS_INPUT_COLUMNS, 8, '');
Support::setIfNotSet($this->formSpec, F_BS_NOTE_COLUMNS, 1, '');
Support::setIfNotSet($this->formSpec, F_SUBMIT_BUTTON_TEXT, '');
// Clear
$this->store->setVar(SYSTEM_FORM_ELEMENT, '', STORE_SYSTEM);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment