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

Merge branch '5285-typeAheadPedantic-As-Default' into 'master'

Bug #5285 - Make typeAheadPedantic the default

See merge request !41
parents c4495018 414539db
...@@ -1497,7 +1497,7 @@ To decide which Parameter should be placed on *Form.parameter* and which on *For ...@@ -1497,7 +1497,7 @@ To decide which Parameter should be placed on *Form.parameter* and which on *For
+-----------------------------+----------------------------------+---------------------------------------------------------------+------+-------------+----------+ +-----------------------------+----------------------------------+---------------------------------------------------------------+------+-------------+----------+
| typeAheadLimit | 20 (default) | Result will be limited to this number of entries | x | x | TA | | typeAheadLimit | 20 (default) | Result will be limited to this number of entries | x | x | TA |
+-----------------------------+----------------------------------+---------------------------------------------------------------+------+-------------+----------+ +-----------------------------+----------------------------------+---------------------------------------------------------------+------+-------------+----------+
| typeAheadPedantic | typeAheadPedantic | Activate 'pedantic' mode - only valid keys are allowed | x | x | TA | | typeAheadPedantic | typeAheadPedantic=0 | Turn off 'pedantic' mode - allow any values (see below) | x | x | TA |
+-----------------------------+----------------------------------+---------------------------------------------------------------+------+-------------+----------+ +-----------------------------+----------------------------------+---------------------------------------------------------------+------+-------------+----------+
| typeAheadMinLength | 2 (default) | Minimum number of characters before starting the search | x | x | TA | | typeAheadMinLength | 2 (default) | Minimum number of characters before starting the search | x | x | TA |
+-----------------------------+----------------------------------+---------------------------------------------------------------+------+-------------+----------+ +-----------------------------+----------------------------------+---------------------------------------------------------------+------+-------------+----------+
...@@ -1547,14 +1547,17 @@ the user types something. ...@@ -1547,14 +1547,17 @@ the user types something.
Pedantic Pedantic
^^^^^^^^ ^^^^^^^^
In case the typed value (technically this is the value of the *id*, latest in the moment when loosing the focus) have The *typeAheadPedantic* mode ensures that the typed value (technically this is the value of the *id*, latest in the moment
to be a valid (= exist on the LDAP server), the *typeAheadPedantic* mode can be activated. when loosing the focus) is valid (= exists on the LDAP server or is defined in `typeAheadSql`).
If the user typed something and that is not a valid *id*, the client (=browser) will delete the input when loosing the focus. If the user typed something and that is not a valid *id*, the client (=browser) will delete the input when losing the focus.
To identify the exact *id*, an additional search filter is necessary: `ypeAheadLdapSearchPrefetch` - see next topic. To identify the exact *id*, an additional search filter is necessary: `typeAheadLdapSearchPrefetch` - see next topic.
*typeAheadPedantic* is active by default when *typeAheadLdap* or *typeAheadSql* is defined, but can be turned off with
*typeAheadPedantic=0*.
* *Form.parameter* or *FormElement.parameter*: * *Form.parameter* or *FormElement.parameter*:
* *typeAheadPedantic* * *typeAheadPedantic=0*
Prefetch Prefetch
^^^^^^^^ ^^^^^^^^
......
...@@ -1067,7 +1067,7 @@ abstract class AbstractBuildForm { ...@@ -1067,7 +1067,7 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute(DATA_TYPEAHEAD_SIP, $dataSip); $attribute .= Support::doAttribute(DATA_TYPEAHEAD_SIP, $dataSip);
$attribute .= Support::doAttribute(DATA_TYPEAHEAD_LIMIT, $formElement[FE_TYPEAHEAD_LIMIT]); $attribute .= Support::doAttribute(DATA_TYPEAHEAD_LIMIT, $formElement[FE_TYPEAHEAD_LIMIT]);
$attribute .= Support::doAttribute(DATA_TYPEAHEAD_MINLENGTH, $formElement[FE_TYPEAHEAD_MINLENGTH]); $attribute .= Support::doAttribute(DATA_TYPEAHEAD_MINLENGTH, $formElement[FE_TYPEAHEAD_MINLENGTH]);
if (isset($formElement[FE_TYPEAHEAD_PEDANTIC])) { if (isset($formElement[FE_TYPEAHEAD_PEDANTIC]) && $formElement[FE_TYPEAHEAD_PEDANTIC] === '1') {
$attribute .= Support::doAttribute(DATA_TYPEAHEAD_PEDANTIC, 'true'); $attribute .= Support::doAttribute(DATA_TYPEAHEAD_PEDANTIC, 'true');
} }
} }
......
...@@ -750,6 +750,14 @@ class Support { ...@@ -750,6 +750,14 @@ class Support {
$formElement[FE_MODE] = self::applyFormModeToFormElement($formElement[FE_MODE], $formSpec[F_MODE]); $formElement[FE_MODE] = self::applyFormModeToFormElement($formElement[FE_MODE], $formSpec[F_MODE]);
} }
// set typeAheadPedantic
if (isset($formElement[FE_TYPEAHEAD_PEDANTIC]) && $formElement[FE_TYPEAHEAD_PEDANTIC] === '') {
$formElement[FE_TYPEAHEAD_PEDANTIC] = '1'; // support legacy option of 'typeAheadPedantic' without a value
}
if (isset($formElement[FE_TYPEAHEAD_LDAP]) || isset($formElement[FE_TYPEAHEAD_SQL])) {
self::setIfNotSet($formElement, FE_TYPEAHEAD_PEDANTIC, '1');
}
// Will be used to change dynamicUpdate behaviour // Will be used to change dynamicUpdate behaviour
if (isset($formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE])) { if (isset($formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE])) {
$formElement[FE_FLAG_ROW_OPEN_TAG] = Support::findInSet('row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]); $formElement[FE_FLAG_ROW_OPEN_TAG] = Support::findInSet('row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
......
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