formapro / JsFormValidatorBundle

The Javascript validation for Symfony 2, 3 and 4 forms
MIT License
128 stars 57 forks source link

Can't enable just a few forms for validation #56

Open CSchulz opened 10 years ago

CSchulz commented 10 years ago

Hello,

I have globally disabled the validation and want to add some specific forms. So I added the required options to the default options of the resolver, but it doesn't work.

Only the configuration is created and not the model. I have located the issue here:

https://github.com/formapro/JsFormValidatorBundle/blob/master/Form/Subscriber/SubscriberToQueue.php#L50

I am note sure about your complete system but changing it to the following works for me:

// Add only parent forms which are not disabled
if ($globalSwitch && $localSwitch || !$globalSwitch && $localSwitch) {

Yes you can remove $globalSwitch.

Perhaps it would be an idea to add an additional field for overriding the global configuration instead. The change from above remove the option to disable the validation globally.