Hi Noel,
> I have a User entity, and two forms: a subscribe form, and a "edit profile"
> form. In the first one, I have two fields: the username, and the password.
> In the second, username, password, first name and last name.
> Actually, if I add the annotation "@validation:NotBlank" on the first name
> and last name fields, I can't validate the first form (I have the error
> "This field cannot be blank").
> Is it just possible? How can I do that?
You can use validation groups for that. One possible solution is:
class User
{
/**
* @validation:NotBlank(groups = {"Default", "Subscription"})
*/
protected $username;
/**
* @validation:NotBlank(groups = {"Default", "Subscription"})
*/
protected $password;
/**
* @validation:NotBlank
*/
protected $firstName;
/**
* @validation:NotBlank
*/
protected $lastName;
}
All constraints are in group "Default" implicitely. With the above
code you add the group "Subscription" to $username and $password. Then
you can tell your subscription form to only validate that group.
$form->setValidationGroups('Subscription');
> Second case, file uploads
The FileField is not finished yet, so this might be a bug. I'll look into it.
Cheers,
Bernhard
--
Software Architect & Engineer
Blog: http://webmozarts.com
Twitter: http://twitter.com/webmozart
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
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