- Notifications
You must be signed in to change notification settings - Fork 299
Open
Description
Bugs when modding multiple times with multiple.
#305 related bugs.
$options = [ 'choices' => ['en' => 'English', 'fr' => 'French'], 'choice_options' => [ 'wrapper' => ['class' => 'choice-wrapper'], 'label_attr' => ['class' => 'label-class'], ], 'expanded' => true, 'multiple' => true ]; $this->plainForm->add('test', 'choice', $options); echo $this->plainForm->test->getName(); // test var_dump($this->plainForm->test->getOption('tmp.multipleBracesSet')); // Null $this->plainForm->modify('test', 'choice', [ 'rules' => 'required', ]); echo $this->plainForm->test->getName(); // test[] var_dump($this->plainForm->test->getOption('tmp.multipleBracesSet')); // true $this->plainForm->modify('test', 'choice', [ 'rules' => 'required', ]); echo $this->plainForm->test->getName(); // test var_dump($this->plainForm->test->getOption('tmp.multipleBracesSet')); // trueI think codes of modding name should move to render method and remove side effects.
laravel-form-builder/src/Kris/LaravelFormBuilder/Fields/FormField.php
Lines 293 to 296 in 735c258
| if ($this->getOption('attr.multiple') && !$this->getOption('tmp.multipleBracesSet')) { | |
| $this->name = $this->name . '[]'; | |
| $this->setOption('tmp.multipleBracesSet', true); | |
| } |
Metadata
Metadata
Assignees
Labels
No labels