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 ...@@ -530,12 +530,24 @@ Field: Form.parameter
+------------------------+--------+---------------------------------------------------------------------------------------------------+ +------------------------+--------+---------------------------------------------------------------------------------------------------+
| class | string | HTML div with given class, surrounding the whole form. Eg.: class=container-fluid | | 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: * Example:
* maxVisiblePill = 5 * maxVisiblePill = 5
* class = container-fluid * 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 FormElements
------------ ------------
* Each *form* contains one or more *FormElement*. * Each *form* contains one or more *FormElement*.
......
...@@ -159,8 +159,6 @@ abstract class AbstractBuildForm { ...@@ -159,8 +159,6 @@ abstract class AbstractBuildForm {
// <form> // <form>
if ($mode === FORM_LOAD) { if ($mode === FORM_LOAD) {
$htmlHead = $this->head(); $htmlHead = $this->head();
$htmlTail = $this->tail();
$htmlSubrecords = $this->doSubrecords();
} }
$filter = $this->getProcessFilter(); $filter = $this->getProcessFilter();
...@@ -178,6 +176,13 @@ abstract class AbstractBuildForm { ...@@ -178,6 +176,13 @@ abstract class AbstractBuildForm {
$recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP); $recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP);
$htmlElements = $this->elements($recordId, $filter, 0, $json, $modeCollectFe, $htmlElementNameIdZero, $storeUse, $mode); $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); $htmlSip = $this->buildHiddenSip($json);
return ($mode === FORM_LOAD) ? $htmlHead . $htmlElements . $htmlSip . $htmlTail . $htmlSubrecords : $json; return ($mode === FORM_LOAD) ? $htmlHead . $htmlElements . $htmlSip . $htmlTail . $htmlSubrecords : $json;
...@@ -313,10 +318,6 @@ abstract class AbstractBuildForm { ...@@ -313,10 +318,6 @@ abstract class AbstractBuildForm {
} }
abstract public function tail();
abstract public function doSubrecords();
abstract public function getProcessFilter(); abstract public function getProcessFilter();
/** /**
...@@ -435,6 +436,10 @@ abstract class AbstractBuildForm { ...@@ -435,6 +436,10 @@ abstract class AbstractBuildForm {
abstract public function fillWrapLabelInputNote($label, $input, $note); 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. * Create a hidden sip, based on latest STORE_SIP Values. Return complete HTML 'hidden' element.
* *
......
...@@ -119,6 +119,7 @@ class BuildFormBootstrap extends AbstractBuildForm { ...@@ -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 * Simulate Submit Button: http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml
* *
* @return string * @return string
...@@ -141,7 +142,7 @@ class BuildFormBootstrap extends AbstractBuildForm { ...@@ -141,7 +142,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
} }
// Button: Save // 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'; $toolTip = 'Save';
if ($this->showDebugInfo) { if ($this->showDebugInfo) {
...@@ -205,6 +206,8 @@ class BuildFormBootstrap extends AbstractBuildForm { ...@@ -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 $id
* @param $title * @param $title
* @param $icon * @param $icon
...@@ -212,7 +215,16 @@ class BuildFormBootstrap extends AbstractBuildForm { ...@@ -212,7 +215,16 @@ class BuildFormBootstrap extends AbstractBuildForm {
* @return string * @return string
*/ */
private function buildButtonCode($id, $title, $icon, $disabled = '') { 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 { ...@@ -308,6 +320,19 @@ class BuildFormBootstrap extends AbstractBuildForm {
$formId = $this->getFormId(); $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 .= '</div> <!--class="tab-content" -->'; // <div class="tab-content">
// $html .= '<input type="submit" value="Submit">'; // $html .= '<input type="submit" value="Submit">';
......
...@@ -434,6 +434,7 @@ const GLYPH_ICON_CLOSE = 'glyphicon-remove'; ...@@ -434,6 +434,7 @@ const GLYPH_ICON_CLOSE = 'glyphicon-remove';
const F_TABLE_NAME = 'tableName'; const F_TABLE_NAME = 'tableName';
const F_REQUIRED_PARAMETER = 'requiredParameter'; const F_REQUIRED_PARAMETER = 'requiredParameter';
const F_SUBMIT_BUTTON_TEXT = 'submitButtonText';
// FORM_ELEMENT_STATI // FORM_ELEMENT_STATI
const FE_MODE_SHOW = 'show'; const FE_MODE_SHOW = 'show';
......
...@@ -351,6 +351,8 @@ class QuickFormQuery { ...@@ -351,6 +351,8 @@ class QuickFormQuery {
Support::setIfNotSet($this->formSpec, F_BS_INPUT_COLUMNS, 8, ''); Support::setIfNotSet($this->formSpec, F_BS_INPUT_COLUMNS, 8, '');
Support::setIfNotSet($this->formSpec, F_BS_NOTE_COLUMNS, 1, ''); Support::setIfNotSet($this->formSpec, F_BS_NOTE_COLUMNS, 1, '');
Support::setIfNotSet($this->formSpec, F_SUBMIT_BUTTON_TEXT, '');
// Clear // Clear
$this->store->setVar(SYSTEM_FORM_ELEMENT, '', STORE_SYSTEM); $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