[FLOW3-general] Weight / compound error messages

"Christian Müller (FLOW3 Team)" christian.mueller at typo3.org
Tue May 8 19:35:44 CEST 2012


Hi,

I would go the way of other viewhelpers and return true for the 
SizeValidator as long as it isn't even an image, so it actually 
validates only if the property is something that can have width and height.

Cheers,
Christian

On 08/05/12 17:45, Adrian Föder wrote:
> Hi again,
>
> again a general issue, happening on a concrete use case of mine that'll
> explain what I mean.
>
> I want to validate an image upload, it's annotated with two validators:
>
> * @FLOW3\Validate([...]SizeValidator, options={ "minimumWidth"=180,
> "minimumHeight"=180 })
> * @FLOW3\Validate([...]TypeValidator, options={
> "allowedTypes"={"jpeg","png","gif"} })
>
> When uploading a text file for example, I satisfyingly get the following
> errors:
>
> 1319801362: The actual image width of 0 is lower than the allowed
> minimum width of 180.
>
> 1319801925: The actual image height of 0 is lower than the allowed
> minimum height of 180.
>
> 1328030664: The uploaded file is no valid image.
>
> That's fine, but you could imaging that I want to have kind of two
> stages of validation, first stage would affect >>1328030664: The
> uploaded file is no valid image.<<, next stage would affect the
> remaining errors.
>
> Is there already something in planning that accommodates that? For a
> pretty simple solution it would even be sufficient to allow setting up
> the ViewHelper to show only e.g. one error at a stage, with a specific
> sort order, maybe
>
> <f:form.validationResults
> for="newImage"
> errorCodeOrder="1328030664,1319801362,1319801925"
> errorLimit="1"
> />
>
> (of course just a draft), or, just coming into mind,
>
> <f:form.validationResults
> for="newImage"
> occurrenceCompilation="[1328030664],[1319801362,1319801925]"
> />
>
>
> Your thoughts?
>
> Best,
> Adrian


-- 
Christian Mueller
TYPO3 Core Team

TYPO3 .... inspiring people to share!
Get involved: typo3.org



More information about the FLOW3-general mailing list