Bug #39673
closedFlexForm value was saved, regardless if &$set was set or not in checkValue-process
0%
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.
Files
Updated by Stefan Froemken over 12 years ago
- File 39673.diff 39673.diff added
I have added a patch which solves the problem.
Updated by Frans Saris almost 10 years ago
- Status changed from New to Needs Feedback
- Is Regression set to No
Hi Stefan,
Could you push the patch to gerrit if this is still an issue?
Updated by Alexander Opitz over 9 years ago
- Status changed from Needs Feedback to Closed
No feedback within the last 90 days => closing this issue.
If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.