You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we are using TYPO3 11.5.24 and powermail_cond 10.0.0 and I think I have found a bug with multi checkbox value handling.
When using a powermail form with a multi checkbox selection field where one of them should enable an input field by value matching, then powermail_cond hide the input field initially. So this works as attended, but if we select the trigger checkbox, the input field will still be disabled and hidden.
Our checkbox value which should be enable the input field is "Arbeitnehmer/in". We have used the following powermail condition for this use case:
Conditions
Which field is affected (target field)?
inputX
What should happen to the chosen field?
unhide
Conjunction of the rules (if more than only 1)
OR
Rules
Which field starts the condition (start field)?
checkboxY
Operator
contains value
Value
Arbeitnehmer/in
This was working for TYPO3 10, but fails with TYPO3 11 now. For this reason I have checked the following part of the Comparison evaluate method:
case Rule::OPERATOR_CONTAINS_VALUE:
return $this->operationContains($leftFieldValue, $valueToMatch);
which will lead to a comparison of something like this:
strpos('["Arbeitnehmer\/in"]', 'Arbeitnehmer/in')
inside the operationContains method which will return false, because the slash will be escaped. To fix this issue the following method:
public function getFieldValue(Field $field)
{
$value = $field->getText();
if (($value[0] ?? '') === '{') {
try {
return json_decode($value, true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $exception) {
// No JSON, no problem.
}
}
return $value;
}
could be extended to:
public function getFieldValue(Field $field)
{
$value = $field->getText();
$firstCharacter = $value[0] ?? '';
if ($firstCharacter === '{' || $firstCharacter === '[') {
try {
return json_decode($value, true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $exception) {
// No JSON, no problem.
}
}
return $value;
}
which will lead to a json_decode of a json formatted array string, so a php array will be checked inside operationContains for multi checkbox values instead of a json decoded array string.
What do you think? :)
The text was updated successfully, but these errors were encountered:
Hi,
we are using TYPO3 11.5.24 and powermail_cond 10.0.0 and I think I have found a bug with multi checkbox value handling.
When using a powermail form with a multi checkbox selection field where one of them should enable an input field by value matching, then powermail_cond hide the input field initially. So this works as attended, but if we select the trigger checkbox, the input field will still be disabled and hidden.
Our checkbox value which should be enable the input field is "Arbeitnehmer/in". We have used the following powermail condition for this use case:
Conditions
Which field is affected (target field)?
inputX
What should happen to the chosen field?
unhide
Conjunction of the rules (if more than only 1)
OR
Rules
Which field starts the condition (start field)?
checkboxY
Operator
contains value
Value
Arbeitnehmer/in
This was working for TYPO3 10, but fails with TYPO3 11 now. For this reason I have checked the following part of the Comparison evaluate method:
which will lead to a comparison of something like this:
strpos('["Arbeitnehmer\/in"]', 'Arbeitnehmer/in')
inside the operationContains method which will return false, because the slash will be escaped. To fix this issue the following method:
could be extended to:
which will lead to a json_decode of a json formatted array string, so a php array will be checked inside operationContains for multi checkbox values instead of a json decoded array string.
What do you think? :)
The text was updated successfully, but these errors were encountered: