====== Admin validation syntax - one big confusion ======
===== Version from the Symfony screencast =====
This one runs for me.
{{frantisek:admin-validation-yaml.jpg|}}
===== Version from the Symfony cheat sheet reference for the generator =====
Here's the complete PDF sheet - http://www.symfony-project.com/uploads/assets/sfAdminGeneratorRefCard.pdf
{{frantisek:admin-validation-cheat-sheet.jpg|}}
===== Confusing version from the Symfony Book =====
Refer to Listing 14-36 for a detail of the special validator syntax for generated forms.
//Listing 14-36 - Validator File Syntax for Administration-Generated Forms//
## Replace square brackets by curly brackets in the fields list
fields:
article{title}:
required:
msg: You must provide a title
## For validator parameters, use the original field name between quotes
sfCompareValidator:
check: "user[newpassword]"
compare_error: The password confirmation does not match the password.
//from the [[http://www.symfony-project.com/book/1_0/14-Generators#Form Validation|Chapter 14]] of the Symfony Book//
methods:
post:
- "sklad{vyrobek_id}"
- "sklad{sn}"
- "sklad{created_at}"
names:
sklad{vyrobek_id}:
required: yes
required_msg: Typ výrobku musí být zadán.
sklad{sn}:
required: yes
required_msg: SN musí být zadáno.
validators: sfRegexValidator
sklad{created_at}:
required: yes
required_msg: Datum přijetí musí být zadáno.
fillin:
activate: true
sfRegexValidator:
class: sfRegexValidator
param:
match: yes
match_error: Špatně zadaný tvar SN.
pattern: /(([A-Za-z0-9\s]+)\.+([A-Za-z0-9\s]+))|([A-Za-z0-9\s,]+)/si
===== Links =====
[[http://www.symfony-project.com/book/1_0/10-Forms#Form Validation|Chapter 10 - Form Validation]]