diff --git a/resources/views/forms/groups/checkboxes.blade.php b/resources/views/forms/groups/checkboxes.blade.php
index a13308bc..b89bb2ae 100644
--- a/resources/views/forms/groups/checkboxes.blade.php
+++ b/resources/views/forms/groups/checkboxes.blade.php
@@ -7,7 +7,7 @@
'errorsId' => $errorsId = $groupId . ($errorsSuffix ?? 'Errors'),
'labelAttributes' => $legendAttributes ?? [],
])
-
+
@include('kontour::forms.partials.checkableOptions')
@include('kontour::forms.partials.errors')
\ No newline at end of file
diff --git a/resources/views/forms/groups/multiselect.blade.php b/resources/views/forms/groups/multiselect.blade.php
index ab40331d..e302f43f 100644
--- a/resources/views/forms/groups/multiselect.blade.php
+++ b/resources/views/forms/groups/multiselect.blade.php
@@ -2,7 +2,7 @@
data-selected-options="{{ implode(' ', $selected = collect(($errors->any() ? old($name) : null) ?? $selected ?? $model[$name] ?? [])->map(function($item) { return strval($item instanceof Illuminate\Database\Eloquent\Model ? $item->getKey() : $item); })->all()) }}"
@include('kontour::forms.partials.groupAttributes')
>
-
+
@include('kontour::forms.label', [
'controlId' => $controlId = $controlId ?? (($idPrefix ?? '') . $name),
])
diff --git a/resources/views/forms/partials/inputAttributes.blade.php b/resources/views/forms/partials/inputAttributes.blade.php
index acaff76f..2bb9855f 100644
--- a/resources/views/forms/partials/inputAttributes.blade.php
+++ b/resources/views/forms/partials/inputAttributes.blade.php
@@ -1,4 +1,4 @@
-name="{{ preg_replace('/\.([^\.]*)/', '[$1]', $name) }}"
+@include('kontour::forms.partials.nameAttribute')
id="{{ $controlId }}"
@if($errors->hasAny($errorsKeys ?? $name))
aria-invalid="true"
diff --git a/resources/views/forms/partials/nameAttribute.blade.php b/resources/views/forms/partials/nameAttribute.blade.php
new file mode 100644
index 00000000..a0fa206c
--- /dev/null
+++ b/resources/views/forms/partials/nameAttribute.blade.php
@@ -0,0 +1 @@
+name="{{ preg_replace('/\.([^.[]+)/', '[$1]', $name) }}"
\ No newline at end of file
diff --git a/tests/Feature/FormViewTests/CheckboxesTest.php b/tests/Feature/FormViewTests/CheckboxesTest.php
index ff02d658..65ef3731 100644
--- a/tests/Feature/FormViewTests/CheckboxesTest.php
+++ b/tests/Feature/FormViewTests/CheckboxesTest.php
@@ -19,6 +19,17 @@ public function test_checkboxes_has_array_name()
$this->assertRegExp('//', $output);
}
+ public function test_checkboxes_has_array_name_from_dot_notation()
+ {
+ $output = View::make('kontour::forms.checkboxes', [
+ 'name' => 'test.name.in.dot.notation',
+ 'options' => ['a' => 'A', 'b' => 'B'],
+ 'errors' => new MessageBag,
+ ])->render();
+
+ $this->assertRegExp('//', $output);
+ }
+
public function test_checkboxes_has_hidden_presence_input()
{
$output = View::make('kontour::forms.checkboxes', [
@@ -30,6 +41,17 @@ public function test_checkboxes_has_hidden_presence_input()
$this->assertRegExp('/[\S\s]*/', $output);
}
+ public function test_checkboxes_has_hidden_presence_input_from_dot_notation()
+ {
+ $output = View::make('kontour::forms.checkboxes', [
+ 'name' => 'test.name.in.dot.notation',
+ 'options' => ['a' => 'A', 'b' => 'B'],
+ 'errors' => new MessageBag,
+ ])->render();
+
+ $this->assertRegExp('/[\S\s]*/', $output);
+ }
+
public function test_fieldset_can_have_custom_control_id()
{
$output = View::make('kontour::forms.checkboxes', [
diff --git a/tests/Feature/FormViewTests/MultiselectTest.php b/tests/Feature/FormViewTests/MultiselectTest.php
index 30553b0d..a5865958 100644
--- a/tests/Feature/FormViewTests/MultiselectTest.php
+++ b/tests/Feature/FormViewTests/MultiselectTest.php
@@ -19,6 +19,18 @@ public function test_multiselect_has_array_name()
$this->assertRegExp('/