If you have defined validation groups as a callback:
namespace Acme\DemoBundle\Form;
class UserType extends AbstractType
{
// ...
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(
array(
'data_class' => 'Acme\DemoBundle\Entity\User',
'validation_groups' => function () {
if (...) {
return array(...);
} else {
return array(...);
}
}
)
);
}
}
Then you have to implement it on the JS side:
$('form#user').jsFormValidator({
groups: function () {
if (...) {
return [...];
} else {
return [...];
}
}
});
Pure Javascript:
var field = document.getElementById('user');
FpJsFormValidator.customize(field, {
groups: function () {
if (...) {
return [...];
} else {
return [...];
}
}
});