laravel-form-builder
laravel-form-builder copied to clipboard
Checkbox get two "[][]" if using modify
Hello,
if I use modify on field-type "choice" I get html like "fieldName[][]" as name attribute. Here is my controller-code to reproduce:
public function testModify()
{
$form = FormBuilder::plain()
->add('name', 'text')
->add('test', 'choice', [
'choices' => ['en' => 'English', 'fr' => 'French'],
'choice_options' => [
'wrapper' => ['class' => 'choice-wrapper'],
'label_attr' => ['class' => 'label-class'],
],
'expanded' => true,
'multiple' => true
]);
$form->modify('test', 'choice', [
'rules' => 'required',
]);
$form->add('submit', 'submit');
return View::make('cdou.form', ['form' => $form]);
}
Best Regards!
@SebTM please avoid modify
method, since there are some issues with it https://github.com/kristijanhusak/laravel-form-builder/issues/237
Hello,
I understand that there are currently issues with "modify". I really need to use the method as this example is only to reproduce the issue. I have a complex crud-system which uses form-classes to provide the basic-functionallity but the validation-configuration comes from another configuration.
Is there any possibility to archiv/fix this?
@SebTM I have the same problem, as quick fix pass "tmp" to options field to avoid add [] multi times
'tmp' => ['multipleBracesSet' => true],