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

AbstractBuildForm.php, QuickFormQuery.php: Added specific validator.js error...

AbstractBuildForm.php, QuickFormQuery.php: Added specific validator.js error text definition to remaining HTML form elements. Not sure if all of them will benefit of it.
parent 372993e5
...@@ -967,6 +967,7 @@ abstract class AbstractBuildForm { ...@@ -967,6 +967,7 @@ abstract class AbstractBuildForm {
$attributeBase = $this->getAttributeFeMode($formElement[FE_MODE]); $attributeBase = $this->getAttributeFeMode($formElement[FE_MODE]);
$attributeBase .= Support::doAttribute('type', $formElement[FE_TYPE]); $attributeBase .= Support::doAttribute('type', $formElement[FE_TYPE]);
$attributeBase .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
switch ($formElement['checkBoxMode']) { switch ($formElement['checkBoxMode']) {
case 'single': case 'single':
...@@ -1163,6 +1164,7 @@ abstract class AbstractBuildForm { ...@@ -1163,6 +1164,7 @@ abstract class AbstractBuildForm {
} }
$attribute .= $this->getAttributeList($formElement, ['autofocus']); $attribute .= $this->getAttributeList($formElement, ['autofocus']);
$attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
$html = $this->buildNativeHidden($htmlFormElementId, $formElement['unchecked']); $html = $this->buildNativeHidden($htmlFormElementId, $formElement['unchecked']);
...@@ -1202,6 +1204,7 @@ abstract class AbstractBuildForm { ...@@ -1202,6 +1204,7 @@ abstract class AbstractBuildForm {
// $attributeBase .= Support::doAttribute('name', $htmlFormElementId); // $attributeBase .= Support::doAttribute('name', $htmlFormElementId);
$attributeBase .= Support::doAttribute('data-load', ($formElement['dynamicUpdate'] === 'yes') ? 'data-load' : ''); $attributeBase .= Support::doAttribute('data-load', ($formElement['dynamicUpdate'] === 'yes') ? 'data-load' : '');
$attributeBase .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
$html = $this->buildNativeHidden(HelperFormElement::prependFormElementIdCheckBoxMulti($htmlFormElementId, 'h'), ''); $html = $this->buildNativeHidden(HelperFormElement::prependFormElementIdCheckBoxMulti($htmlFormElementId, 'h'), '');
...@@ -1316,6 +1319,7 @@ abstract class AbstractBuildForm { ...@@ -1316,6 +1319,7 @@ abstract class AbstractBuildForm {
$this->getKeyValueListFromSqlEnumSpec($formElement, $itemKey, $itemValue); $this->getKeyValueListFromSqlEnumSpec($formElement, $itemKey, $itemValue);
$attributeBase = $this->getAttributeFeMode($formElement[FE_MODE]); $attributeBase = $this->getAttributeFeMode($formElement[FE_MODE]);
$attributeBase .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
$attributeBase .= Support::doAttribute('name', $htmlFormElementId); $attributeBase .= Support::doAttribute('name', $htmlFormElementId);
$attributeBase .= Support::doAttribute('type', $formElement[FE_TYPE]); $attributeBase .= Support::doAttribute('type', $formElement[FE_TYPE]);
$attributeBase .= Support::doAttribute('data-load', ($formElement['dynamicUpdate'] === 'yes') ? 'data-load' : ''); $attributeBase .= Support::doAttribute('data-load', ($formElement['dynamicUpdate'] === 'yes') ? 'data-load' : '');
...@@ -1400,6 +1404,7 @@ abstract class AbstractBuildForm { ...@@ -1400,6 +1404,7 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('title', $formElement['tooltip']); $attribute .= Support::doAttribute('title', $formElement['tooltip']);
$attribute .= $this->getAttributeList($formElement, ['autofocus']); $attribute .= $this->getAttributeList($formElement, ['autofocus']);
$attribute .= Support::doAttribute('data-load', ($formElement['dynamicUpdate'] === 'yes') ? 'data-load' : ''); $attribute .= Support::doAttribute('data-load', ($formElement['dynamicUpdate'] === 'yes') ? 'data-load' : '');
$attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
if (isset($formElement['size']) && $formElement['size'] > 1) { if (isset($formElement['size']) && $formElement['size'] > 1) {
$attribute .= Support::doAttribute('size', $formElement['size']); $attribute .= Support::doAttribute('size', $formElement['size']);
...@@ -1962,6 +1967,7 @@ abstract class AbstractBuildForm { ...@@ -1962,6 +1967,7 @@ abstract class AbstractBuildForm {
// 'maxLength' needs an upper 'L': naming convention for DB tables! // 'maxLength' needs an upper 'L': naming convention for DB tables!
$attribute .= $this->getAttributeList($formElement, ['size', 'maxLength']); $attribute .= $this->getAttributeList($formElement, ['size', 'maxLength']);
$attribute .= Support::doAttribute('value', htmlentities($value), false); $attribute .= Support::doAttribute('value', htmlentities($value), false);
$attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
if ($formElement['placeholder'] == '') { if ($formElement['placeholder'] == '') {
$timePattern = ($formElement[FE_SHOW_SECONDS] == 1) ? 'hh:mm:ss' : 'hh:mm'; $timePattern = ($formElement[FE_SHOW_SECONDS] == 1) ? 'hh:mm:ss' : 'hh:mm';
...@@ -2121,6 +2127,7 @@ abstract class AbstractBuildForm { ...@@ -2121,6 +2127,7 @@ abstract class AbstractBuildForm {
$attribute .= $this->getAttributeFeMode($formElement[FE_MODE]); $attribute .= $this->getAttributeFeMode($formElement[FE_MODE]);
$attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
$json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]); $json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]);
......
...@@ -506,6 +506,8 @@ class QuickFormQuery { ...@@ -506,6 +506,8 @@ class QuickFormQuery {
} }
/** /**
* If not already defined, set various defaults on the form.
*
* @param array $formSpec * @param array $formSpec
* @return array * @return array
*/ */
...@@ -549,7 +551,10 @@ class QuickFormQuery { ...@@ -549,7 +551,10 @@ class QuickFormQuery {
} }
/** /**
* @param $feSpecNative * Copy specific attributes defined on the form to all FormElements.
*
* @param array $formSpec
* @param array $feSpecNative
* @return mixed * @return mixed
*/ */
private function copyAttributesToFormElements(array $formSpec, array $feSpecNative) { private function copyAttributesToFormElements(array $formSpec, array $feSpecNative) {
......
Supports Markdown
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