eZ Community » Learn » eZ Publish » Create a feedback form in eZ Publish...

Create a feedback form in eZ Publish 5 using ezforms-bundle

Monday 12 May 2014 3:33:49 pm

  • Currently 3 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Configure data validation

We haven't specified validation rules for our forms. You may see error messages if you try to submit the empty form but this is only browser validation triggered by HTML5 attributes. By default, all fields are tagged as required (you may mark them as not required in your form type). The email field being of type email, modern browsers will also check that it contains an @.

These are cool features indeed but try to submit an empty or invalid form in older IE... We'll need some server side validation as well.

Once again, Symfony will make it really easy for us, a single yml file doing the trick:

 

The main key is the model class fully qualified name. We then define for each property a list of validation contraints to check value against. Each constraint can be customized with a set of options, see the validation constraints reference for a detailed list of the available constraints and their options. As always with Symfony, it is also possible to define your own validation constraints.

 

 

Printable

Printer Friendly version of the full article on one page with plain styles

Author(s)

Proudly Developed with from