[FLOW3-general] Problem with validation

Martin titusmailing at googlemail.com
Tue Apr 10 17:38:45 CEST 2012


I found a strange a solution but, is this state of the art?

The @FLOW3\Validate(type="StringLength", options={ "minimum"=1,
  "maximum"=200 })

--> minimum  does not work for empty Forms therefore u have to add: 
@FLOW3\Validate(type="notEmpty")

to get an empty Form validate, after that u can specify your the minimum 
and maximum...

For my point of view it should be included in the minimum check!

Greetz

Martin




On 04/10/2012 02:48 PM, Martin wrote:
> Dear List,
>
> I am trying to implement standard validation. But th eobject is still
> created without any errors. I manly followed the Blog example on the
> Definite Guide an on the git repository.
>
> Can someone give me a clue what is wrong or if I have to enable
> validation. I recreated the Database and emptied the cache severaltimes...
>
> Thanx alot!
>
> Martin
>
> My Model with:
>
> /**
> * The theme
> * @var string
> * @FLOW3\Validate(type="StringLength", options={ "minimum"=1,
> "maximum"=200 })
> * @ORM\Column(length=200)
> */
> protected $theme;
>
> in the Model.
>
> In the view I am having:
>
> <f:form action="create" name="newSeminar" object="{newSeminar}"
> enctype="multipart/form-data">
>
>
> and my renderings:
>
> <f:render partial="FormErrors" arguments="{for: 'newSeminar'}" />
>
> The Partial looks like:
>
>
> <f:form.validationResults for="{for}">
> <f:if condition="{validationResults.flattenedErrors}">
> <dl class="errors">
> <f:for each="{validationResults.flattenedErrors}" key="propertyPath"
> as="errors">
> <dt>
> {propertyPath}:
> </dt>
> <dd>
> <f:for each="{errors}" as="error">{error}</f:for>
> </dd>
> </f:for>
> </dl>
> </f:if>
> </f:form.validationResults>
>


More information about the FLOW3-general mailing list