#39673FlexForm value was saved, regardless if &$set was set or not in checkValue-process
Description
Hello TYPO3-Core-Team,
I have found following in your TCE-Documentation regarding own validators:
&$set : Boolean defining if the value is written to the database or not. Must be passed by reference and changed if needed.
I have used this validator in a FlexForm:
<settings.prependPdfs>
<TCEforms>
<exclude>1</exclude>
<label>Prepend following PDFs</label>
<config>
<type>text</type>
<cols>50</cols>
<rows>5</rows>
<eval>Tx_KeEinkaufsplaner_Validator_Eval</eval>
</config>
</TCEforms>
</settings.prependPdfs>
Now we come to the part with $set:
public function evaluateFieldValue($value, $is_in, &$set) {
if (empty($value)) return $value;
if (preg_match('/[^a-zA-Z0-9_-]/', $value)) {
//t3lib_utility_Debug::debug('unallowed letters found', 'ERROR');
$set = FALSE;
} else {
//t3lib_utility_Debug::debug('OK', 'OK');
$set = TRUE;
}
return $value;
}
I’m sure: If I am NOT working within a FlexForm it will work without any problems!
In method: checkValue_flex_procInData_travDS you only override an existing value instead of creating a new value. That’s why ALL FlexForm values are ALWAYS saved, regardless if I break saving process with $set = FALSE or TRUE:
// Adding the value:
if (isset($res['value'])) {
$dataValues[$key][$vKey] = $res['value'];
}
While in method fillInFieldArray you fill a nearly empty $fieldArray:
// Evaluating the value
$res = $this->checkValue($table, $field, $fieldValue, $id, $status, $realPid, $tscPID);
if (isset($res['value'])) {
$fieldArray[$field] = $res['value'];
}
If I break saving process here, the requested value will not be added to $fieldArray and will not be saved in database.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.