nico_bl1nd wrote:
> Hi,
>
> I got some problem with the validation of form.
> When I first get on the form, I get this error :
> Notice: Array to string conversion in /usr/local/php5/lib/php/symfony/
> util/sfToolkit.class.php on line 329
>
> And then when I validate my form, the sfStringValidator is not checked
> by the system.
>
> Does anyone have any idea ?
>
> thanks
>
> Nicolas Binet
>
> Ps: My create.yml file
>
> methods:
> post:
> - "customer{name}"
> - "customer{base_domain}"
> - "customer{max_date}"
> - "customer{max_partners}"
> - "customer{max_learner}"
> - "customer{max_storage}"
>
> names:
> customer{name}:
> required: yes
> required_msg: Veuillez saisir un nom
> sfStringValidator:
> values: [foo, bar]
> values_error: The only accepted values are foo and bar
> insensitive: false
> min: 2
> min_error: Please enter at least 2 characters
> max: 100
> max_error: Please enter less than 100 characters
>
> customer{base_domain}:
> required: yes
> required_msg: Veuillez saisir une url pour le client
>
> customer{max_date}:
> required: yes
> required_msg: Veuillez saisir une date pour la fin de contrat
>
> customer{max_partners}:
> required: yes
> required_msg: Veuillez saisir un nombre maximum de partenaires
>
> customer{max_learner}:
> required: yes
> required_msg: Veuillez saisir un nombre maximum d'apprenants
>
> customer{max_storage}:
> required: yes
> required_msg: Veuillez saisir une limite pour le stockage
> autorisé
>
>
> >
>
>
Interesting. I am not that into the validation systems and tried your
validation yml file and got the same results. Seems like with names: you
cannot go deeper that second level. For example:
names:
customer{base_domain}:
required:
msg: Veuillez saisir une url pour le client
The above does not work. You have to do:
names:
customer{base_domain}:
required: yes
required_msg: Veuillez saisir une url pour le client
but if you use fields: instead of names: then you can put validators and
such. I think you are misunderstanding the use of names: and I could not
find anything in the Symfony book which can shed more light on the issue.
You can use the following validation yml file I came up with:
fields:
customer{name}:
required:
msg: Veuillez saisir un nom
sfStringValidator:
values: [foo, bar]
values_error: The only accepted values are foo and bar
insensitive: false
min: 2
min_error: Please enter at least 2 characters
max: 100
max_error: Please enter less than 100 characters
customer{base_domain}:
required:
msg: Veuillez saisir une url pour le client
customer{max_date}:
required:
msg: Veuillez saisir une date pour la fin de contrat
customer{max_partners}:
required:
msg: Veuillez saisir un nombre maximum de partenaires
customer{max_learner}:
required:
msg: Veuillez saisir un nombre maximum d'apprenants
customer{max_storage}:
required:
msg: Veuillez saisir une limite pour le stockage autorisé
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---