 <p>I think it will be very useful to you to look at the code of the validator of <a href="http://trac.symfony-project.org/browser/plugins/sfDoctrineGuardPlugin/trunk/lib/validator/sfGuardValidatorUser.class.php" rel="nofollow noreferrer">sfDoctrineGuardPlugin</a>. They create that post validator, and <a href="http://trac.symfony-project.org/browser/plugins/sfDoctrineGuardPlugin/trunk/lib/form/doctrine/base/BasesfGuardFormSignin.class.php" rel="nofollow noreferrer">set it in the form</a>. Even if you don't want to use sfDoctrineGuardPlugin (or sfGuardPlugin if you use Propel) its code can be a valuable source of inspiration. </p>