[TYPO3-mvc] validator too greedy, conditional validation?

Gerhard Mehsel sparking at gmx.net
Thu Sep 5 17:53:30 CEST 2013


Hello,

I have an extbase plugin that is inserted on a page two times. Each 
plugin has some form fields and both forms are sent to the same 
createAction in controller (it's the same plugin with different form 
fields) and so both forms share the same validator annotations.

Since the second plugin has upload form fields it needs to have a 
validator for uploads (filesize, file extension, successful upload, 
...). The first plugin does not need this validator.

If the second form is sent, the validators of the createAction are 
called twice - once for the first plugin (that is not sent) and once for 
the second plugin.

Since the upload validator does the upload stuff also and moves the 
uploaded temporary file to its destination, there is no longer a 
temporary file for the second call of the validator and therefore it can 
never be valid.

A solution would be to somehow distinguish between the first and the 
second call in validator and do the upload stuff only when really needed.

Is there a possibilty to do a conditional validation in any way?

Best regards,
Gerd


More information about the TYPO3-project-typo3v4mvc mailing list