symfony2admingenerator / AvocodeFormExtensionsBundle

(old-legacy) Symfony2 form extensions for Admingenerator project (also working standalone!)
Other
48 stars 31 forks source link

help form type #102

Closed fadoe closed 10 years ago

fadoe commented 10 years ago

I don't know if it is a admin generator or a form extension problem. When I use

title:
   label: blablub
   formOptions:
        help: Somehelp

this field changed to required. I have a form type checkbox. Without the help I can check and uncheck the field. With help I must check or I can't safe. Same problem with a input field in the filter. Without help I can leave the text field empty, filter works. With help I must insert something.

Restless-ET commented 10 years ago

@fadoe I believe that's because you used "formOptions" instead of "addFormOptions".

ioleo commented 10 years ago

@Restless-ET I was not aware that useing formOptions instead of addFormOptions sets the required to TRUE. I am curious why is that so. Can you point to the code responsible for this?

sescandell commented 10 years ago

Actuually @Restless-ET is probably right.

using formOptionsinstead of addFormOptions will completly redefine the options passed to the form constrcutor (if I remember well, didn't check the code). So, as described in the Symfony2 Form documentation, the default value for the requiredattribute is true => so this field becomes mandatory.

=> use addFormOptions instead

ioleo commented 10 years ago

This should work as expected:

title:
   label: blablub
   addFormOptions:
        help: Somehelp

Does this resolve your issue @Restless-ET ?

Restless-ET commented 10 years ago

Yes, that sample includes the change I was suggesting to @fadoe for solving his issue.