-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
There are use cases for returning null in a FormType definition with the call getBlockPrefix, for example to for a GET form to only use the form values in the resulting URL without a form name inside square brackets.
A typical case would be to simply add
public function getBlockPrefix()
{
return null;
}
to the formType.
However, this name is also being used to build the opening
tag when using{{ form_start(form) }}
in the twig template. As a result of the null name, your form tag is created as:
<form name="" method="get">
The empty name "" is invalid HTML5 and will fail an HTML scan.
It would be preferable to simply leave the name off altogether in this case, i.e.
<form method="get">
if blockprefix is null.