php - Dynamic validation groups in Symfony Forms - via listener or defaultoptions? -
i have form accepts username, password , category_id (and stores doctrine "user" entity). creates business relationship in database , using validator have checked required. extend form back upwards facebook , twitter logins (and perchance others) have created new entity userloginexternal hold token , token provider. when user submits form fb login submit username, category_id, token , providers. have created 2 validation groups in validator - register , register_without_password can't find efficient way switch in formtype based on whether token field submitted or not.
can point me place in symfony docs can find info example. read listeners in form types not have access request there see if token field submitted.
in case want maintain 1 form have switch validation groups based on submitted data. symfony framework offers functionality using callback that.
you'll find more info in symfony documentation: http://symfony.com/doc/current/book/forms.html#groups-based-on-the-submitted-data
php facebook forms validation symfony2
No comments:
Post a Comment