Reputation: 469
I created a Form in Symfony2, with the field "name" set to the type "text"... But for some reason, I can't use any spaces in this field... I get the following error:
form type name ("") is not valid
I tried renaming the field and changing the type to "textarea", but the problem remains.
Here is how the form is defined:
$builder -> add('name', 'text')
Can anybody tell me what the problem is?
Upvotes: 1
Views: 158
Reputation: 13891
What about adding
public function getName()
{
return 'your_type_name';
}
to your Type.
Note that the getName()
method should return a unique identifier for the form "type".
Upvotes: 1