diff --git a/src/MultipleInputColumn.php b/src/MultipleInputColumn.php index e92c20c..d5f476a 100644 --- a/src/MultipleInputColumn.php +++ b/src/MultipleInputColumn.php @@ -49,9 +49,16 @@ public function getElementName($index, $withPrefix = true) $index = '{' . $this->renderer->getIndexPlaceholder() . '}'; } - $elementName = $this->isRendererHasOneColumn() - ? '[' . $this->name . '][' . $index . ']' - : '[' . $index . '][' . $this->name . ']'; + if ($this->isRendererHasOneColumn()) { + $prefix = $this->getInputNamePrefix(); + if ($prefix === '') { + $elementName = $this->name . '[' . $index . ']'; + } else { + $elementName = '[' . $this->name . '][' . $index . ']'; + } + } else { + $elementName = '[' . $index . '][' . $this->name . ']'; + } if (!$withPrefix) { return $elementName; @@ -73,7 +80,7 @@ private function isRendererHasOneColumn() $columns = \array_filter($this->renderer->columns, function(self $column) { return $column->type !== self::TYPE_DRAGCOLUMN; }); - + return count($columns) === 1; }