Closed
Description
When RepeatedType is nested inside another form, error messages such as "This value should not be blank" bubble up to the root form, instead of appearing above the field in the nested form.
To illustrate this issue, I have put together the following example:
- Two types where one is nested in the other (child inside parent).
- Both types have the RepeatedType field.
- Both RepeatedType fields are NotBlank.
As you can see, the error message for the RepeatedType in the main type, appears right above the fields, but this doesn't happen for the nested type.
Here are the types and models that can be used to demonstrate the issue:
class RegistrationParent
{
public $registrationChild;
/**
* @Assert\NotBlank()
*/
public $plainPassword;
}
class RegistrationChild
{
/**
* @Assert\NotBlank()
*/
public $plainPassword;
}
class RegistrationParentFormType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('registrationChild', new RegistrationChildFormType())
->add('plainPassword', 'repeated', array(
'type' => 'password',
))
;
}
class RegistrationChildFormType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('plainPassword', 'repeated', array(
'type' => 'password',
))
;
}