Commit 4ea0c458 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixes #9521 Textarea auto-grow - PHP and JS have been lost in GIT!

parent 85a66cd9
Pipeline #2664 passed with stages
in 2 minutes and 48 seconds
...@@ -1406,7 +1406,6 @@ abstract class AbstractBuildForm { ...@@ -1406,7 +1406,6 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]); $attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]);
$attribute .= Support::doAttribute('name', $htmlFormElementName); $attribute .= Support::doAttribute('name', $htmlFormElementName);
$attribute .= Support::doAttribute('class', $class);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]); $attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
if (isset($formElement[FE_RETYPE_SOURCE_NAME])) { if (isset($formElement[FE_RETYPE_SOURCE_NAME])) {
...@@ -1444,10 +1443,14 @@ abstract class AbstractBuildForm { ...@@ -1444,10 +1443,14 @@ abstract class AbstractBuildForm {
// Check for input type 'textarea'. Possible notation: a) '', b) '<width>', c) '<width>,<height>', d) '<width>,<min-height>,<max-height>' // Check for input type 'textarea'. Possible notation: a) '', b) '<width>', c) '<width>,<height>', d) '<width>,<min-height>,<max-height>'
$colsRows = explode(',', $formElement[FE_SIZE], 3); $colsRows = explode(',', $formElement[FE_SIZE], 3);
// AutoHeight if (empty($colsRows[1])) {
$colsRows[1] = HelperFormElement::textareaAutoHeight($colsRows, $value); $colsRows[1] = 1;
}
$flagTextarea = ($colsRows[1] > 1); $flagTextarea = ($colsRows[1] > 1);
// AutoHeight
// $colsRows[1] = HelperFormElement::textareaAutoHeight($colsRows, $value);
$formElement = HelperFormElement::prepareExtraButton($formElement, !$flagTextarea); $formElement = HelperFormElement::prepareExtraButton($formElement, !$flagTextarea);
...@@ -1456,6 +1459,16 @@ abstract class AbstractBuildForm { ...@@ -1456,6 +1459,16 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('cols', $colsRows[0]); $attribute .= Support::doAttribute('cols', $colsRows[0]);
$attribute .= Support::doAttribute('rows', $colsRows[1]); $attribute .= Support::doAttribute('rows', $colsRows[1]);
if (($formElement[FE_TEXTAREA_RESIZE] ?? '1') == '0') {
$attribute .= Support::doAttribute('style', 'resize: none;');
}
// Check if $colsRows[2] != 0 >> enable auto-grow (if nothing is defined: enable auto-grow)
$maxHeight = $colsRows[2] ?? '350';
if ($maxHeight != '0') {
$class .= ' ' . CLASS_FORM_ELEMENT_AUTO_GROW;
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_MAX_HEIGHT, $maxHeight);
}
$textarea = htmlentities($value) . '</textarea>'; $textarea = htmlentities($value) . '</textarea>';
} else { } else {
$htmlTag = '<input'; $htmlTag = '<input';
...@@ -1480,6 +1493,7 @@ abstract class AbstractBuildForm { ...@@ -1480,6 +1493,7 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute(F_FE_DATA_PATTERN_ERROR, $formElement[F_FE_DATA_PATTERN_ERROR], true, ESCAPE_WITH_BACKSLASH); $attribute .= Support::doAttribute(F_FE_DATA_PATTERN_ERROR, $formElement[F_FE_DATA_PATTERN_ERROR], true, ESCAPE_WITH_BACKSLASH);
} }
if ($formElement[FE_MODE] == FE_MODE_REQUIRED) { if ($formElement[FE_MODE] == FE_MODE_REQUIRED) {
$attribute .= Support::doAttribute(F_FE_DATA_REQUIRED_ERROR, $formElement[F_FE_DATA_REQUIRED_ERROR]); $attribute .= Support::doAttribute(F_FE_DATA_REQUIRED_ERROR, $formElement[F_FE_DATA_REQUIRED_ERROR]);
} }
...@@ -1495,6 +1509,8 @@ abstract class AbstractBuildForm { ...@@ -1495,6 +1509,8 @@ abstract class AbstractBuildForm {
$attribute .= $this->getAttributeFeMode($formElement[FE_MODE], false); $attribute .= $this->getAttributeFeMode($formElement[FE_MODE], false);
$attribute .= Support::doAttribute('class', $class);
$json = $this->getFormElementForJson($htmlFormElementName, $value, $formElement); $json = $this->getFormElementForJson($htmlFormElementName, $value, $formElement);
$input = "$htmlTag $attribute>$textarea"; $input = "$htmlTag $attribute>$textarea";
......
...@@ -858,6 +858,11 @@ const DATA_CHARACTER_COUNT_ID = 'data-character-count-id'; ...@@ -858,6 +858,11 @@ const DATA_CHARACTER_COUNT_ID = 'data-character-count-id';
const CLASS_FORM_ELEMENT_EDIT = 'qfq-form-element-edit'; const CLASS_FORM_ELEMENT_EDIT = 'qfq-form-element-edit';
const CLASS_FORM_ELEMENT_AUTO_GROW = 'qfq-auto-grow';
const ATTRIBUTE_DATA_MAX_HEIGHT = 'data-max-height';
// BuildForm // BuildForm
const SYMBOL_NEW = 'new'; const SYMBOL_NEW = 'new';
const SYMBOL_EDIT = 'edit'; const SYMBOL_EDIT = 'edit';
...@@ -1241,6 +1246,7 @@ const FE_RECORD_DESTINATION_TABLE = 'recordDestinationTable'; ...@@ -1241,6 +1246,7 @@ const FE_RECORD_DESTINATION_TABLE = 'recordDestinationTable';
const FE_RECORD_SOURCE_TABLE = 'recordSourceTable'; const FE_RECORD_SOURCE_TABLE = 'recordSourceTable';
const FE_TRANSLATE_ID_COLUMN = 'translateIdColumn'; const FE_TRANSLATE_ID_COLUMN = 'translateIdColumn';
const FE_EMPTY_MEANS_NULL = 'emptyMeansNull'; const FE_EMPTY_MEANS_NULL = 'emptyMeansNull';
const FE_TEXTAREA_RESIZE = 'textareaResize';
const FE_EMPTY_ITEM_AT_START = 'emptyItemAtStart'; const FE_EMPTY_ITEM_AT_START = 'emptyItemAtStart';
const FE_EMPTY_ITEM_AT_END = 'emptyItemAtEnd'; const FE_EMPTY_ITEM_AT_END = 'emptyItemAtEnd';
const FE_SUBRECORD_TABLE_CLASS = 'subrecordTableClass'; const FE_SUBRECORD_TABLE_CLASS = 'subrecordTableClass';
......
...@@ -200,25 +200,25 @@ VALUES ...@@ -200,25 +200,25 @@ VALUES
'<a tabindex="-1" href="{{documentation:Y}}#form-name">Info</a>', '', '', '', '<a tabindex="-1" href="{{documentation:Y}}#form-name">Info</a>', '', '', '',
'autofocus\ndata-pattern-error=Allowed characters: alphabet, number or . - +', 'autofocus\ndata-pattern-error=Allowed characters: alphabet, number or . - +',
1, '', '', '', 'specialchar', 'no', '[a-zA-Z0-9._+-]+'), 1, '', '', '', 'specialchar', 'no', '[a-zA-Z0-9._+-]+'),
(1, 'title', 'Title', 'show', 'text', 'all', 'native', 120, '80,2,15', 0, (1, 'title', 'Title', 'show', 'text', 'all', 'native', 120, '80,2', 0,
'<a tabindex="-1" href="{{documentation:Y}}#form-title">Info</a>', '<a tabindex="-1" href="{{documentation:Y}}#form-title">Info</a>',
'', '', '', '', 1, '', '', '', 'none', 'no', ''), '', '', '', '', 1, '', '', '', 'none', 'no', ''),
(1, 'noteInternal', 'Note', 'show', 'text', 'all', 'native', 130, '80,2,15', 0, (1, 'noteInternal', 'Note', 'show', 'text', 'all', 'native', 130, '80,2', 0,
'<a tabindex="-1" href="{{documentation:Y}}#form-note">Info</a>', '', '', '', '', 1, '', '', '', 'specialchar', 'no', '<a tabindex="-1" href="{{documentation:Y}}#form-note">Info</a>', '', '', '', '', 1, '', '', '', 'specialchar', 'no',
''), ''),
(1, 'tableName', 'Table', 'required', 'select', 'all', 'native', 140, 0, 0, (1, 'tableName', 'Table', 'required', 'select', 'all', 'native', 140, 0, 0,
'<a tabindex="-1" href="{{documentation:Y}}#form-tablename">Info</a>', '', '', '{{[{{indexData:Y}}]!SHOW tables}}', '<a tabindex="-1" href="{{documentation:Y}}#form-tablename">Info</a>', '', '', '{{[{{indexData:Y}}]!SHOW tables}}',
'emptyItemAtStart', 1, '', '', '', 'specialchar', 'no', ''), 'emptyItemAtStart', 1, '', '', '', 'specialchar', 'no', ''),
(1, 'parameterLanguageA', 'Language: {{formLanguageALabel:YE}}', 'show', 'text', 'all', 'native', 150, '80,2,15', 0, (1, 'parameterLanguageA', 'Language: {{formLanguageALabel:YE}}', 'show', 'text', 'all', 'native', 150, '80,2', 0,
'<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '', '<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '',
'{{SELECT IF("{{formLanguageAId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''), '{{SELECT IF("{{formLanguageAId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''),
(1, 'parameterLanguageB', 'Language: {{formLanguageBLabel:YE}}', 'show', 'text', 'all', 'native', 160, '80,2,15', 0, (1, 'parameterLanguageB', 'Language: {{formLanguageBLabel:YE}}', 'show', 'text', 'all', 'native', 160, '80,2', 0,
'<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '', '<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '',
'{{SELECT IF("{{formLanguageBId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''), '{{SELECT IF("{{formLanguageBId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''),
(1, 'parameterLanguageC', 'Language: {{formLanguageCLabel:YE}}', 'show', 'text', 'all', 'native', 170, '80,2,15', 0, (1, 'parameterLanguageC', 'Language: {{formLanguageCLabel:YE}}', 'show', 'text', 'all', 'native', 170, '80,2', 0,
'<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '', '<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '',
'{{SELECT IF("{{formLanguageCId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''), '{{SELECT IF("{{formLanguageCId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''),
(1, 'parameterLanguageD', 'Language: {{formLanguageDLabel:YE}}', 'show', 'text', 'all', 'native', 180, '80,2,15', 0, (1, 'parameterLanguageD', 'Language: {{formLanguageDLabel:YE}}', 'show', 'text', 'all', 'native', 180, '80,2', 0,
'<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '', '<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '',
'{{SELECT IF("{{formLanguageDId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''), '{{SELECT IF("{{formLanguageDId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''),
...@@ -238,7 +238,7 @@ VALUES ...@@ -238,7 +238,7 @@ VALUES
(1, 'labelAlign', 'Label Align', 'show', 'radio', 'alnumx', 'native', 225, 0, 5, (1, 'labelAlign', 'Label Align', 'show', 'radio', 'alnumx', 'native', 225, 0, 5,
'<a tabindex="-1" href="{{documentation:Y}}#definition">Info</a>', '', '', '', 'buttonClass', 3, '', '<a tabindex="-1" href="{{documentation:Y}}#definition">Info</a>', '', '', '', 'buttonClass', 3, '',
'', '', 'specialchar', 'no', ''), '', '', 'specialchar', 'no', ''),
(1, 'parameter', 'Parameter', 'show', 'text', 'all', 'native', 230, '80,2,15', 0, (1, 'parameter', 'Parameter', 'show', 'text', 'all', 'native', 230, '80,2', 0,
'<a tabindex="-1" href="{{documentation:Y}}#form-parameter">Info</a>', '', '', '', '', 3, '', '', '', 'none', 'no', '<a tabindex="-1" href="{{documentation:Y}}#form-parameter">Info</a>', '', '', '', '', 3, '', '', '', 'none', 'no',
''), ''),
(1, 'bsLabelColumns', 'BS Label Columns', 'show', 'text', 'all', 'native', 240, 0, 0, (1, 'bsLabelColumns', 'BS Label Columns', 'show', 'text', 'all', 'native', 240, 0, 0,
...@@ -302,7 +302,7 @@ VALUES ...@@ -302,7 +302,7 @@ VALUES
(1, 'multiMode', 'Multi Mode', 'show', 'radio', 'all', 'native', 520, 0, 0, '', '', '', '', 'buttonClass', 5, '', '', (1, 'multiMode', 'Multi Mode', 'show', 'radio', 'all', 'native', 520, 0, 0, '', '', '', '', 'buttonClass', 5, '', '',
'', '',
'specialchar', 'no', ''), 'specialchar', 'no', ''),
(1, 'multiSql', 'Multi SQL', 'show', 'text', 'all', 'native', 530, '80,2,15', 0, '', '', '', '', '', 5, '', '', '', (1, 'multiSql', 'Multi SQL', 'show', 'text', 'all', 'native', 530, '80,2', 0, '', '', '', '', '', 5, '', '', '',
'none', 'no', ''), 'none', 'no', ''),
(1, 'multiDetailForm', 'Multi Detail Form', 'show', 'text', 'all', 'native', 540, 0, 0, '', '', '', '', '', 5, (1, 'multiDetailForm', 'Multi Detail Form', 'show', 'text', 'all', 'native', 540, 0, 0, '', '', '', '', '', 5,
'', '', '', 'specialchar', 'no', ''), '', '', '', 'specialchar', 'no', ''),
...@@ -380,22 +380,22 @@ VALUES (2, 'feIdContainer', 'Container', 'show', 'select', 'all', 'native', 120, ...@@ -380,22 +380,22 @@ VALUES (2, 'feIdContainer', 'Container', 'show', 'select', 'all', 'native', 120,
'', 100, '', 'yes', '', '', '', '', 100, '', 'yes', '', '', '',
'{{ SELECT IF("{{type:FRE:alnumx}}"="subrecord" AND "{{class:FRE:alnumx}}"="native", "show", "hidden") }}', '', '{{ SELECT IF("{{type:FRE:alnumx}}"="subrecord" AND "{{class:FRE:alnumx}}"="native", "show", "hidden") }}', '',
'specialchar'), 'specialchar'),
(2, 'parameterLanguageA', 'Language: {{formLanguageALabel:YE}}', 'show', 'text', 'all', 'native', 210, '80,2,15', (2, 'parameterLanguageA', 'Language: {{formLanguageALabel:YE}}', 'show', 'text', 'all', 'native', 210, '80,2',
0, 0,
'<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '', '<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '',
'', '', '', '',
'{{SELECT IF("{{formLanguageAId:YE}}"="","hidden","show" ) }}', '', 'none'), '{{SELECT IF("{{formLanguageAId:YE}}"="","hidden","show" ) }}', '', 'none'),
(2, 'parameterLanguageB', 'Language: {{formLanguageBLabel:YE}}', 'show', 'text', 'all', 'native', 210, '80,2,15', (2, 'parameterLanguageB', 'Language: {{formLanguageBLabel:YE}}', 'show', 'text', 'all', 'native', 210, '80,2',
0, 0,
'<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '', '<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '',
'', '', '', '',
'{{SELECT IF("{{formLanguageBId:YE}}"="","hidden","show" ) }}', '', 'none'), '{{SELECT IF("{{formLanguageBId:YE}}"="","hidden","show" ) }}', '', 'none'),
(2, 'parameterLanguageC', 'Language: {{formLanguageCLabel:YE}}', 'show', 'text', 'all', 'native', 210, '80,2,15', (2, 'parameterLanguageC', 'Language: {{formLanguageCLabel:YE}}', 'show', 'text', 'all', 'native', 210, '80,2',
0, 0,
'<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '', '<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '',
'', '', '', '',
'{{SELECT IF("{{formLanguageCId:YE}}"="","hidden","show" ) }}', '', 'none'), '{{SELECT IF("{{formLanguageCId:YE}}"="","hidden","show" ) }}', '', 'none'),
(2, 'parameterLanguageD', 'Language: {{formLanguageDLabel:YE}}', 'show', 'text', 'all', 'native', 210, '80,2,15', (2, 'parameterLanguageD', 'Language: {{formLanguageDLabel:YE}}', 'show', 'text', 'all', 'native', 210, '80,2',
0, 0,
'<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '', '<a tabindex="-1" href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '',
'', '', '', '',
...@@ -427,7 +427,7 @@ VALUES (2, 'feIdContainer', 'Container', 'show', 'select', 'all', 'native', 120, ...@@ -427,7 +427,7 @@ VALUES (2, 'feIdContainer', 'Container', 'show', 'select', 'all', 'native', 120,
# '<a tabindex="-1" href="{{documentation:Y}}#field-tabindex">Info</a>', '', '', '', '', 101, '', 'no', '', '', # '<a tabindex="-1" href="{{documentation:Y}}#field-tabindex">Info</a>', '', '', '', '', 101, '', 'no', '', '',
# '', '', '', # '', '', '',
# 'specialchar'), # 'specialchar'),
(2, 'adminNote', 'Internal Note', 'show', 'text', 'all', 'native', 360, '80,2,15', 0, '', '', '', '', '', 101, (2, 'adminNote', 'Internal Note', 'show', 'text', 'all', 'native', 360, '80,2', 0, '', '', '', '', '', 101,
'', '',
'no', 'no',
'', '', '', '',
...@@ -465,7 +465,7 @@ VALUES (2, 'feIdContainer', 'Container', 'show', 'select', 'all', 'native', 120, ...@@ -465,7 +465,7 @@ VALUES (2, 'feIdContainer', 'Container', 'show', 'select', 'all', 'native', 120,
'<a tabindex="-1" href="{{documentation:Y}}#field-maxlength">Info</a>', '', '', '', '', 102, '', 'no', '', '', '<a tabindex="-1" href="{{documentation:Y}}#field-maxlength">Info</a>', '', '', '', '', 102, '', 'no', '', '',
'', '', '', '', '', '',
'specialchar'), 'specialchar'),
(2, 'note', 'Note', 'show', 'text', 'all', 'native', 460, '80,2,15', 0, (2, 'note', 'Note', 'show', 'text', 'all', 'native', 460, '80,2', 0,
'<a tabindex="-1" href="{{documentation:Y}}#field-note">Info</a>', '', '', '', '', 102, '', 'no', '', '', '', '<a tabindex="-1" href="{{documentation:Y}}#field-note">Info</a>', '', '', '', '', 102, '', 'no', '', '', '',
'', '', 'none'), '', '', 'none'),
(2, 'tooltip', 'Tooltip', 'show', 'text', 'all', 'native', 470, 0, 0, (2, 'tooltip', 'Tooltip', 'show', 'text', 'all', 'native', 470, 0, 0,
...@@ -477,14 +477,14 @@ VALUES (2, 'feIdContainer', 'Container', 'show', 'select', 'all', 'native', 120, ...@@ -477,14 +477,14 @@ VALUES (2, 'feIdContainer', 'Container', 'show', 'select', 'all', 'native', 120,
'', '', '', '', '', '',
'none'), 'none'),
(2, 'value', 'value', 'show', 'text', 'all', 'native', 500, '80,2,15', 0, (2, 'value', 'value', 'show', 'text', 'all', 'native', 500, '80,2', 0,
'<a tabindex="-1" href="{{documentation:Y}}#field-value">Info</a>', '', '', '', '', 103, '', 'no', '', '', '', '<a tabindex="-1" href="{{documentation:Y}}#field-value">Info</a>', '', '', '', '', 103, '', 'no', '', '', '',
'', '', '', '',
'none'), 'none'),
(2, 'sql1', 'sql1', 'show', 'text', 'all', 'native', 510, '80,2,15', 0, (2, 'sql1', 'sql1', 'show', 'text', 'all', 'native', 510, '80,2', 0,
'<a tabindex="-1" href="{{documentation:Y}}#sql1">Info</a><br><br>MariaDB: <a tabindex="-1" href="https://mariadb.com/kb/en/mariadb/select/">Select</a>, <a tabindex="-1" href="https://mariadb.com/kb/en/mariadb/functions-and-operators/">Functions</a>', '<a tabindex="-1" href="{{documentation:Y}}#sql1">Info</a><br><br>MariaDB: <a tabindex="-1" href="https://mariadb.com/kb/en/mariadb/select/">Select</a>, <a tabindex="-1" href="https://mariadb.com/kb/en/mariadb/functions-and-operators/">Functions</a>',
'', '', '', '', 103, '', 'no', '', '', '', '', '', 'none'), '', '', '', '', 103, '', 'no', '', '', '', '', '', 'none'),
(2, 'parameter', 'Parameter', 'show', 'text', 'all', 'native', 520, '80,2,15', 0, (2, 'parameter', 'Parameter', 'show', 'text', 'all', 'native', 520, '80,2', 0,
'<a tabindex="-1" href="{{documentation:Y}}#fe-parameter-attributes">Info</a>', '<a tabindex="-1" href="{{documentation:Y}}#fe-parameter-attributes">Info</a>',
'', '', '', '', 103, '', 'no', '', '', '', '', '', 'none'); '', '', '', '', 103, '', 'no', '', '', '', '', '', 'none');
...@@ -642,10 +642,10 @@ VALUES (4, 'status', 'Enabled', 'show', '', 'checkbox', 'specialchar', 'alnumx', ...@@ -642,10 +642,10 @@ VALUES (4, 'status', 'Enabled', 'show', '', 'checkbox', 'specialchar', 'alnumx',
(4, 'sql1', 'Mail', 'show', '{{SELECT IF("{{type:FR:alnumx}}"="mail","show","hidden") }}', 'text', 'none', 'all', (4, 'sql1', 'Mail', 'show', '{{SELECT IF("{{type:FR:alnumx}}"="mail","show","hidden") }}', 'text', 'none', 'all',
60, 60,
'extraButtonInfo = Query: &#123;&#123;!SELECT ... as sendMailTo...&#125;&#125;<br><b>sendMailTo / sendMailCc / sendMailBcc</b>: Separate multiple by comma.<br><b>sendMailFrom</b><br><b>sendMailSubject</b><br><b>sendMailReplyTo</b>: Optional<br><b>sendMailFlagAutoSubmit</b>: Optional. on|off. Default on - if "on", suppresses OoO answers from receivers.<br><b>sendMailGrId</b>: Optional<br><b>sendMailXId</b>: Optional', 'extraButtonInfo = Query: &#123;&#123;!SELECT ... as sendMailTo...&#125;&#125;<br><b>sendMailTo / sendMailCc / sendMailBcc</b>: Separate multiple by comma.<br><b>sendMailFrom</b><br><b>sendMailSubject</b><br><b>sendMailReplyTo</b>: Optional<br><b>sendMailFlagAutoSubmit</b>: Optional. on|off. Default on - if "on", suppresses OoO answers from receivers.<br><b>sendMailGrId</b>: Optional<br><b>sendMailXId</b>: Optional',
'80,2,15', '', 'yes', '', '', ''), '80,2', '', 'yes', '', '', ''),
(4, 'content', '{{SELECT IF("{{type:FR:alnumx}}"="mail","Mail body","URL") }}', 'show', '', 'text', 'none', (4, 'content', '{{SELECT IF("{{type:FR:alnumx}}"="mail","Mail body","URL") }}', 'show', '', 'text', 'none',
'all', 70, 'all', 70,
'', '80,2,15', '', '80,2',
'Website: URL absolute like "http://..." or relative like "?id=pagealias..."<br>Mail: Static Body or &#123;{SELECT ...&#125;}', 'Website: URL absolute like "http://..." or relative like "?id=pagealias..."<br>Mail: Static Body or &#123;{SELECT ...&#125;}',
'yes', '', '', ''), 'yes', '', '', ''),
...@@ -660,7 +660,7 @@ VALUES (4, 'status', 'Enabled', 'show', '', 'checkbox', 'specialchar', 'alnumx', ...@@ -660,7 +660,7 @@ VALUES (4, 'status', 'Enabled', 'show', '', 'checkbox', 'specialchar', 'alnumx',
'yes', '', '', ''), 'yes', '', '', ''),
(4, 'lastRun', 'Last run', 'readonly', '', 'text', 'specialchar', 'alnumx', 120, '', '', '', 'no', '', '', ''), (4, 'lastRun', 'Last run', 'readonly', '', 'text', 'specialchar', 'alnumx', 120, '', '', '', 'no', '', '', ''),
(4, 'lastStatus', 'Laststatus', 'readonly', '', 'text', 'specialchar', 'alnumx', 130, '', '80,2,15', '', 'no', (4, 'lastStatus', 'Laststatus', 'readonly', '', 'text', 'specialchar', 'alnumx', 130, '', '80,2', '', 'no',
'3', '3',
'9', '9',
'0'), '0'),
......
...@@ -100,38 +100,38 @@ class BuildFormPlainTest extends AbstractDatabaseTest { ...@@ -100,38 +100,38 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
$label['123-r'][API_ELEMENT_ATTRIBUTE] = ['class' => '']; $label['123-r'][API_ELEMENT_ATTRIBUTE] = ['class' => ''];
$result = $build->buildInput($formElement, 'name:1', '', $json); $result = $build->buildInput($formElement, 'name:1', '', $json);
$this->assertEquals('<input id="123" name="name:1" class="form-control" maxlength="255" type="input" value="" data-error="Error" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="name:1" maxlength="255" type="input" value="" data-error="Error" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json);
// Min/Max // Min/Max
$formElement[FE_MIN] = '1'; $formElement[FE_MIN] = '1';
$formElement[FE_MAX] = '10'; $formElement[FE_MAX] = '10';
$result = $build->buildInput($formElement, 'name:1', '', $json); $result = $build->buildInput($formElement, 'name:1', '', $json);
$this->assertEquals('<input id="123" name="name:1" class="form-control" maxlength="255" type="number" value="" data-error="Error" min="1" max="10" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="name:1" maxlength="255" type="number" value="" data-error="Error" min="1" max="10" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json);
$formElement[FE_MIN] = '1'; $formElement[FE_MIN] = '1';
$formElement[FE_MAX] = ''; $formElement[FE_MAX] = '';
$result = $build->buildInput($formElement, 'name:1', '', $json); $result = $build->buildInput($formElement, 'name:1', '', $json);
$this->assertEquals('<input id="123" name="name:1" class="form-control" maxlength="255" type="input" value="" data-error="Error" min="1" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="name:1" maxlength="255" type="input" value="" data-error="Error" min="1" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json);
$formElement[FE_MIN] = ''; $formElement[FE_MIN] = '';
$formElement[FE_MAX] = '10'; $formElement[FE_MAX] = '10';
$result = $build->buildInput($formElement, 'name:1', '', $json); $result = $build->buildInput($formElement, 'name:1', '', $json);
$this->assertEquals('<input id="123" name="name:1" class="form-control" maxlength="255" type="input" value="" data-error="Error" max="10" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="name:1" maxlength="255" type="input" value="" data-error="Error" max="10" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json);
$formElement[FE_MIN] = '0'; $formElement[FE_MIN] = '0';
$formElement[FE_MAX] = '10'; $formElement[FE_MAX] = '10';
$result = $build->buildInput($formElement, 'name:1', '', $json); $result = $build->buildInput($formElement, 'name:1', '', $json);
$this->assertEquals('<input id="123" name="name:1" class="form-control" maxlength="255" type="input" value="" data-error="Error" min="0" max="10" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="name:1" maxlength="255" type="input" value="" data-error="Error" min="0" max="10" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json);
$formElement[FE_MIN] = '-5'; $formElement[FE_MIN] = '-5';
$formElement[FE_MAX] = '0'; $formElement[FE_MAX] = '0';
$result = $build->buildInput($formElement, 'name:1', '', $json); $result = $build->buildInput($formElement, 'name:1', '', $json);
$this->assertEquals('<input id="123" name="name:1" class="form-control" maxlength="255" type="input" value="" data-error="Error" min="-5" max="0" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="name:1" maxlength="255" type="input" value="" data-error="Error" min="-5" max="0" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json);
// reset so they don't interfere with next tests // reset so they don't interfere with next tests
...@@ -142,14 +142,14 @@ class BuildFormPlainTest extends AbstractDatabaseTest { ...@@ -142,14 +142,14 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
$formElement[FE_CHECK_TYPE] = SANITIZE_ALLOW_PATTERN; $formElement[FE_CHECK_TYPE] = SANITIZE_ALLOW_PATTERN;
$formElement[FE_CHECK_PATTERN] = '^[a-z]*$'; $formElement[FE_CHECK_PATTERN] = '^[a-z]*$';
$result = $build->buildInput($formElement, 'name:1', '', $json); $result = $build->buildInput($formElement, 'name:1', '', $json);
$this->assertEquals('<input id="123" name="name:1" class="form-control" maxlength="255" type="input" value="" pattern="^[a-z]*$" data-pattern-error="' . F_FE_DATA_PATTERN_ERROR_DEFAULT . '" data-error="Error" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="name:1" maxlength="255" type="input" value="" pattern="^[a-z]*$" data-pattern-error="' . F_FE_DATA_PATTERN_ERROR_DEFAULT . '" data-error="Error" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
$label['123'][API_ELEMENT_ATTRIBUTE]['pattern'] = '^[a-z]*$'; $label['123'][API_ELEMENT_ATTRIBUTE]['pattern'] = '^[a-z]*$';
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json);
$formElement[FE_CHECK_TYPE] = SANITIZE_ALLOW_DIGIT; $formElement[FE_CHECK_TYPE] = SANITIZE_ALLOW_DIGIT;
$formElement[FE_CHECK_PATTERN] = ''; $formElement[FE_CHECK_PATTERN] = '';
$result = $build->buildInput($formElement, 'name:1', '', $json); $result = $build->buildInput($formElement, 'name:1', '', $json);
$this->assertEquals('<input id="123" name="name:1" class="form-control" maxlength="255" type="input" value="" pattern="^[\d]*$" data-pattern-error="' . SANITIZE_ALLOW_DIGIT_MESSAGE . '" data-error="Error" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="name:1" maxlength="255" type="input" value="" pattern="^[\d]*$" data-pattern-error="' . SANITIZE_ALLOW_DIGIT_MESSAGE . '" data-error="Error" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
$label['123'][API_ELEMENT_ATTRIBUTE]['pattern'] = '^[\d]*$'; $label['123'][API_ELEMENT_ATTRIBUTE]['pattern'] = '^[\d]*$';
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json);
...@@ -158,7 +158,7 @@ class BuildFormPlainTest extends AbstractDatabaseTest { ...@@ -158,7 +158,7 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
$formElement[FE_CHECK_PATTERN] = ''; $formElement[FE_CHECK_PATTERN] = '';
$result = $build->buildInput($formElement, 'name:1', '', $json); $result = $build->buildInput($formElement, 'name:1', '', $json);
$label['123'][API_ELEMENT_ATTRIBUTE]['pattern'] = '^([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})?$'; $label['123'][API_ELEMENT_ATTRIBUTE]['pattern'] = '^([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})?$';
$this->assertEquals('<input id="123" name="name:1" class="form-control" maxlength="255" type="input" value="" pattern="^([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})?$" data-pattern-error="' . SANITIZE_ALLOW_EMAIL_MESSAGE . '" data-error="Error" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="name:1" maxlength="255" type="input" value="" pattern="^([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})?$" data-pattern-error="' . SANITIZE_ALLOW_EMAIL_MESSAGE . '" data-error="Error" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json);
$formElement[FE_CHECK_TYPE] = SANITIZE_ALLOW_ALL; $formElement[FE_CHECK_TYPE] = SANITIZE_ALLOW_ALL;
...@@ -168,7 +168,7 @@ class BuildFormPlainTest extends AbstractDatabaseTest { ...@@ -168,7 +168,7 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
// Decimal format // Decimal format
$formElement[FE_DECIMAL_FORMAT] = '5,2'; $formElement[FE_DECIMAL_FORMAT] = '5,2';
$result = $build->buildInput($formElement, 'name:1', '', $json); $result = $build->buildInput($formElement, 'name:1', '', $json);
$this->assertEquals('<input id="123" name="name:1" class="form-control" maxlength="255" type="input" value="" pattern="^-?[0-9]{0,3}(\.[0-9]{0,2})?$" data-pattern-error="Requested decimal format (mantis,decimal): 5,2" data-error="Error" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="name:1" maxlength="255" type="input" value="" pattern="^-?[0-9]{0,3}(\.[0-9]{0,2})?$" data-pattern-error="Requested decimal format (mantis,decimal): 5,2" data-error="Error" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
$label['123'][API_ELEMENT_ATTRIBUTE]['pattern'] = '^-?[0-9]{0,3}(\.[0-9]{0,2})?$'; $label['123'][API_ELEMENT_ATTRIBUTE]['pattern'] = '^-?[0-9]{0,3}(\.[0-9]{0,2})?$';
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json);
...@@ -179,14 +179,14 @@ class BuildFormPlainTest extends AbstractDatabaseTest { ...@@ -179,14 +179,14 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
$formElement['size'] = 40; $formElement['size'] = 40;
$formElement['maxLength'] = 40; $formElement['maxLength'] = 40;
$result = $build->buildInput($formElement, 'name:1', '', $json); $result = $build->buildInput($formElement, 'name:1', '', $json);
$this->assertEquals('<input id="123" name="name:1" class="form-control" maxlength="40" type="input" size="40" value="" data-error="Error" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="name:1" maxlength="40" type="input" size="40" value="" data-error="Error" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
unset($label['123'][API_ELEMENT_ATTRIBUTE]['pattern']); unset($label['123'][API_ELEMENT_ATTRIBUTE]['pattern']);
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json);
// maxlength bigger than physical spec: // maxlength bigger than physical spec:
$formElement['maxLength'] = 1000; $formElement['maxLength'] = 1000;
$result = $build->buildInput($formElement, 'name:1', '', $json); $result = $build->buildInput($formElement, 'name:1', '', $json);
$this->assertEquals('<input id="123" name="name:1" class="form-control" maxlength="1000" type="input" size="40" value="" data-error="Error" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="name:1" maxlength="1000" type="input" size="40" value="" data-error="Error" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', API_ELEMENT_UPDATE => $label], $json);
// no size, no maxlength and column not in primary table // no size, no maxlength and column not in primary table
...@@ -195,24 +195,24 @@ class BuildFormPlainTest extends AbstractDatabaseTest { ...@@ -195,24 +195,24 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
$formElement2['size'] = ''; $formElement2['size'] = '';
$formElement2['name'] = 'specialname'; $formElement2['name'] = 'specialname';
$result = $build->buildInput($formElement2, 'specialname:1', '', $json); $result = $build->buildInput($formElement2, 'specialname:1', '', $json);
$this->assertEquals('<input id="123" name="specialname:1" class="form-control" type="input" value="" data-error="Error" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="specialname:1" type="input" value="" data-error="Error" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
// no size, given maxlength and column not in primary table // no size, given maxlength and column not in primary table
$formElement2['maxLength'] = '10'; $formElement2['maxLength'] = '10';
$result = $build->buildInput($formElement2, 'specialname:1', '', $json); $result = $build->buildInput($formElement2, 'specialname:1', '', $json);
$this->assertEquals('<input id="123" name="specialname:1" class="form-control" maxlength="10" type="input" value="" data-error="Error" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="specialname:1" maxlength="10" type="input" value="" data-error="Error" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
// size given, no maxlength and column not in primary table // size given, no maxlength and column not in primary table
$formElement2['maxLength'] = ''; $formElement2['maxLength'] = '';
$formElement2['size'] = '10'; $formElement2['size'] = '10';
$result = $build->buildInput($formElement2, 'specialname:1', '', $json); $result = $build->buildInput($formElement2, 'specialname:1', '', $json);
$this->assertEquals('<input id="123" name="specialname:1" class="form-control" type="input" size="10" value="" data-error="Error" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="specialname:1" type="input" size="10" value="" data-error="Error" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
// size given, maxlength given and column not in primary table // size given, maxlength given and column not in primary table
$formElement2['maxLength'] = '20'; $formElement2['maxLength'] = '20';
$formElement2['size'] = '10'; $formElement2['size'] = '10';
$result = $build->buildInput($formElement2, 'specialname:1', '', $json); $result = $build->buildInput($formElement2, 'specialname:1', '', $json);
$this->assertEquals('<input id="123" name="specialname:1" class="form-control" maxlength="20" type="input" size="10" value="" data-error="Error" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="specialname:1" maxlength="20" type="input" size="10" value="" data-error="Error" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
$formElement2['maxLength'] = ''; $formElement2['maxLength'] = '';
$formElement2['size'] = ''; $formElement2['size'] = '';
...@@ -220,20 +220,20 @@ class BuildFormPlainTest extends AbstractDatabaseTest { ...@@ -220,20 +220,20 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
$formElement2['tooltip'] = 'Nice Tooltip'; $formElement2['tooltip'] = 'Nice Tooltip';
$formElement2['placeholder'] = 'Please type a name'; $formElement2['placeholder'] = 'Please type a name';
$result = $build->buildInput($formElement2, 'name:1', 'Hello World', $json); $result = $build->buildInput($formElement2, 'name:1', 'Hello World', $json);
$this->assertEquals('<input id="123" name="name:1" class="form-control" type="input" value="Hello World" placeholder="Please type a name" data-error="Error" title="Nice Tooltip" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<input id="123" name="name:1" type="input" value="Hello World" placeholder="Please type a name" data-error="Error" title="Nice Tooltip" data-hidden="no" data-required="no" class="form-control" ><div class="help-block with-errors hidden"></div>', $result);
$label['123'][API_ELEMENT_ATTRIBUTE] = ['value' => 'Hello World', 'required' => false, 'hidden' => false]; $label['123'][API_ELEMENT_ATTRIBUTE] = ['value' => 'Hello World', 'required' => false, 'hidden' => false];
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => 'Hello World', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => 'Hello World', API_ELEMENT_UPDATE => $label], $json);
// textarea // textarea
$formElement2['size'] = '40,10'; $formElement2['size'] = '40,10';
$result = $build->buildInput($formElement2, 'name:1', 'Hello World', $json); $result = $build->buildInput($formElement2, 'name:1', 'Hello World', $json);
$this->assertEquals('<textarea id="123" name="name:1" class="form-control" cols="40" rows="10" placeholder="Please type a name" data-error="Error" title="Nice Tooltip" data-hidden="no" data-required="no" >Hello World</textarea><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<textarea id="123" name="name:1" cols="40" rows="10" data-max-height="350" placeholder="Please type a name" data-error="Error" title="Nice Tooltip" data-hidden="no" data-required="no" class="form-control qfq-auto-grow" >Hello World</textarea><div class="help-block with-errors hidden"></div>', $result);
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => 'Hello World', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => 'Hello World', API_ELEMENT_UPDATE => $label], $json);
$formElement2['size'] = ' 40 , 10 '; $formElement2['size'] = ' 40 , 10 ';
$result = $build->buildInput($formElement2, 'name:1', 'Hello World', $json); $result = $build->buildInput($formElement2, 'name:1', 'Hello World', $json);
$this->assertEquals('<textarea id="123" name="name:1" class="form-control" cols="40" rows="10" placeholder="Please type a name" data-error="Error" title="Nice Tooltip" data-hidden="no" data-required="no" >Hello World</textarea><div class="help-block with-errors hidden"></div>', $result); $this->assertEquals('<textarea id="123" name="name:1" cols="40" rows="10" data-max-height="350" placeholder="Please type a name" data-error="Error" title="Nice Tooltip" data-hidden="no" data-required="no" class="form-control qfq-auto-grow" >Hello World</textarea><div class="help-block with-errors hidden"></div>', $result);
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => 'Hello World', API_ELEMENT_UPDATE => $label], $json); $this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => 'Hello World', API_ELEMENT_UPDATE => $label], $json);
} }
...@@ -259,44 +259,44 @@ class BuildFormPlainTest extends AbstractDatabaseTest { ...@@ -259,44 +259,44 @@ class BuildFormPlainTest extends AbstractDatabaseTest {