Broken repeated type
johnthreevolts opened this issue · 2 comments
johnthreevolts commented
Hi, I'm trying to use this bundle, and I got problem with repeated type.
Form code fragment:
#[FormField(RepeatedType::class, [
'first_options' => ['label' => 'admin_user.form_fields.password'],
'required' => true,
'second_options' => ['label' => 'admin_user.form_fields.repeat_password'],
'type' => PasswordType::class,
])]
#[Length(['min' => 6])]
public ?string $password = null;
It results in form which contains 2 labels and 2 empty div's for inputs.
I've tried to check bundle code, and found in AbstractRapidFormType.php
// Handle RepeatedType
if ($type === RepeatedType::class) {
$entryOptions['data_class'] = $formField->options['type'];
$nestedOptions = array_merge($options, [
''type' => AbstractRapidFormType::class,
]);
$builder->add($fieldName, RepeatedType::class, $nestedOptions);
return;
}
Form will be rendered if change previous snippet on:
// Handle RepeatedType
if ($type === RepeatedType::class) {
$builder->add($fieldName, RepeatedType::class, $options);
return;
}
ansien commented
@stoneloxday Thanks for the report! I'm going to look into this asap.
ansien commented
Fixed in 1.1.3