Commit e256aa40 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Feature 3470: Enter As Submit= on/off - implemented

parent 3597d161
......@@ -395,6 +395,8 @@ config.qfq.ini
| FORM_LANGUAGE_C_LABEL | | |
| FORM_LANGUAGE_D_LABEL | | |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| enterAsSubmit | enterAsSubmit = 1 | 0: off, 1: Pressing *enter* in a form means *save* and *close* |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
Example: *typo3conf/config.qfq.ini*
......@@ -1949,8 +1951,6 @@ Parameter
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| classBody | string | HTML div with given class, surrounding all *FormElement*. |
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| submitButtonText | string | Show save button, with the <submitButtonText> at the bottom of the form. |
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| extraDeleteForm | string | Name of a form which specifies how to delete the primary record and optional slave records. |
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| data-pattern-error | string | Pattern violation: Text for error message used for all FormElements of current form. |
......@@ -1990,6 +1990,10 @@ Parameter
| mode | string | The value `readonly` will activate a global readonly mode of the form - the user can't change any data. |
| | | See :ref:`form-mode-global` |
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| enterAsSubmit | digit | 0: off, 1: Pressing *enter* in a form means *save* and *close*. Takes default from `config.qfq.ini`_. |
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| submitButtonText | string | Show a save button at the bottom of the form, with <submitButtonText> . See `submitButtonText`_. |
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| saveButtonActive | - | Make the 'save'-button active on *Form* load (instead of waiting for the first user change). |
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| saveButtonText | string | Overwrite default from config.qfq.ini: SAVE_BUTTON_TEXT |
......@@ -2035,6 +2039,8 @@ Parameter
* class = container-fluid
* classBody = qfq-form-right
.. _submitButtonText:
submitButtonText
''''''''''''''''
......
......@@ -124,3 +124,5 @@ WKHTMLTOPDF = /opt/wkhtmltox/bin/wkhtmltopdf
; FORM_LANGUAGE_D_ID = E.g. FORM_LANGUAGE_D_ID = 4
; FORM_LANGUAGE_D_LABEL = E.g. FORM_LANGUAGE_D_ID = Chinese
; Pressing the 'enter' key is equal to save and close
; enterAsSubmit = 1
\ No newline at end of file
......@@ -318,7 +318,7 @@ abstract class AbstractBuildForm {
public function getFormTag() {
$md5 = '';
$attribute = $this->getFormTagAtrributes();
$attribute = $this->getFormTagAttributes();
$honeypot = $this->getHoneypotVars();
......@@ -396,7 +396,7 @@ abstract class AbstractBuildForm {
*
* @return array
*/
public function getFormTagAtrributes() {
public function getFormTagAttributes() {
$attribute['id'] = $this->getFormId();
$attribute['method'] = 'post';
......@@ -405,6 +405,7 @@ abstract class AbstractBuildForm {
$attribute['accept-charset'] = 'UTF-8';
$attribute[FE_INPUT_AUTOCOMPLETE] = 'on';
$attribute['enctype'] = $this->getEncType();
$attribute['data-disable-return-key-submit'] = $this->formSpec[F_ENTER_AS_SUBMIT] == '1' ? "false" : "true"; // attribute meaning is inverted
return $attribute;
}
......
......@@ -495,7 +495,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
*/
public function getFormTag() {
$attribute = $this->getFormTagAtrributes();
$attribute = $this->getFormTagAttributes();
$attribute['class'] = 'form-horizontal';
$attribute['data-toggle'] = 'validator';
......
......@@ -498,6 +498,8 @@ const SYSTEM_FORM_LANGUAGE_C_LABEL = 'FORM_LANGUAGE_C_LABEL';
const SYSTEM_FORM_LANGUAGE_D_ID = 'FORM_LANGUAGE_D_ID';
const SYSTEM_FORM_LANGUAGE_D_LABEL = 'FORM_LANGUAGE_D_LABEL';
const SYSTEM_ENTER_AS_SUBMIT = 'enterAsSubmit';
const DOCUMENTATION_QFQ = 'DOCUMENTATION_QFQ';
const DOCUMENTATION_QFQ_URL = 'https://docs.typo3.org/typo3cms/drafts/github/T3DocumentationStarter/Public-Info-053/Manual.html';
......@@ -818,6 +820,8 @@ const F_NEW_BUTTON_TOOLTIP = 'newButtonTooltip';
const F_NEW_BUTTON_CLASS = 'newButtonClass';
const F_NEW_BUTTON_GLYPH_ICON = 'newButtonGlyphIcon';
const F_ENTER_AS_SUBMIT = SYSTEM_ENTER_AS_SUBMIT;
// FORM_ELEMENT_STATI
const FE_MODE_SHOW = 'show';
const FE_MODE_READONLY = 'readonly';
......
......@@ -986,6 +986,7 @@ class QuickFormQuery {
Support::setIfNotSet($formSpec, F_LDAP_USE_BIND_CREDENTIALS, '');
Support::setIfNotSet($formSpec, F_MODE, '');
Support::setIfNotSet($formSpec, F_DB_INDEX_DATA, $this->store->getVar(F_DB_INDEX_DATA, STORE_SYSTEM));
Support::setIfNotSet($formSpec, F_ENTER_AS_SUBMIT, $this->store->getVar(SYSTEM_ENTER_AS_SUBMIT, STORE_SYSTEM));
// In case there is no F_MODE defined on the form, check if there is one in STORE_SIP.
if ($formSpec[F_MODE] == '') {
......
......@@ -206,6 +206,7 @@ class Config {
Support::setIfNotSet($config, SYSTEM_RECORD_LOCK_TIMEOUT_SECONDS, SYSTEM_RECORD_LOCK_TIMEOUT_SECONDS_DEFAULT);
Support::setIfNotSet($config, DOCUMENTATION_QFQ, DOCUMENTATION_QFQ_URL);
Support::setIfNotSet($config, SYSTEM_ENTER_AS_SUBMIT, 1);
// Support::setIfNotSet($config, SYSTEM_FILL_STORE_SYSTEM_BY_SQL, SYSTEM_VAR_ADD_BY_SQL_DEFAULT);
......
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