[TYPO3-mvc] new fluid comparator for CheckboxViewhelper
Thomas Mammitzsch
thomas at visualworx.de
Wed Jun 30 16:56:30 CEST 2010
Hi list,
i have a suggestion for a new "in_array" comparator in ViewHelperNode.
Reason is that i'm creating forms in the frontend, where form definition
happens in the backend. Everything works fine, even if i get validation
errors, the form shows up prefilled.
The only exception is the CheckboxViewHelper. Because this is an array
of values (at least if you have multiple checkboxes with the same name
and different values) you can not compare it against a single value
currently.
It would be nice if one can check if a value is in that array, to check
the checkbox in case of validation errors, a return from a
last-check-before-submit page (or generally when the form of the
newAction has to be displayed again). I added one case to the
evaluateComparator method in ViewHelperNode to do that and it works:
case 'in_array':
return in_array($leftSide, $rightSide);
of course i also added 'in_array' also to the comparators static array
in ViewHelperNode.
Could we add this permanently, what do you mean?
regards, Thomas
More information about the TYPO3-project-typo3v4mvc
mailing list