Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a form field that is not in the schema to Doctrine form Symfony 1.4

I have an image upload form and at the bottom, I'd like to have a checkbox that the user must check before submitting the form, certifying that they have the right to distribute the photo. I've tried adding it as a Widget in the Form class, but it is not displaying. What is the best way to accomplish this?

like image 335
Lauren Avatar asked Feb 26 '23 17:02

Lauren


1 Answers

For validation, you can add this to your form class to allow fields outside the model:

$this->validatorSchema->setOption('allow_extra_fields', true);
$this->validatorSchema->setOption('filter_extra_fields', false); // true or false

Other than that, just adding the widget in the standard way should work fine.

like image 98
Tom Avatar answered Apr 06 '23 14:04

Tom