diff --git a/resources/views/form/hasmanytab.blade.php b/resources/views/form/hasmanytab.blade.php
index 07d9ae807..ba6796865 100755
--- a/resources/views/form/hasmanytab.blade.php
+++ b/resources/views/form/hasmanytab.blade.php
@@ -25,14 +25,14 @@
@foreach($forms as $pk => $form)
- {{ $pk }}
+ {{ $form->getTabName() }}
@endforeach
-
+
@foreach($forms as $pk => $form)
@@ -60,7 +60,7 @@
\ No newline at end of file
+
diff --git a/src/Form/Field.php b/src/Form/Field.php
index c6f9a4285..e2ff5fcdc 100755
--- a/src/Form/Field.php
+++ b/src/Form/Field.php
@@ -330,7 +330,7 @@ protected function formatFieldData($data)
$value = [];
foreach ($this->column as $key => $column) {
- $value[$key] = $this->getValueFromData($data, $this->normalizeColumn($column));
+ $value[$key] = $this->getValueFromData($data, $this->normalizeColumn($column), data_get($this->value, $key));
}
return $value;
diff --git a/src/Form/NestedForm.php b/src/Form/NestedForm.php
index 7c799264a..757cac712 100755
--- a/src/Form/NestedForm.php
+++ b/src/Form/NestedForm.php
@@ -54,6 +54,8 @@ class NestedForm extends WidgetForm
*/
protected $form;
+ protected $tabName;
+
/**
* Create a new NestedForm instance.
*
@@ -170,6 +172,25 @@ public function getKey()
return $this->key;
}
+ /**
+ * $nestForm->setTableName($nestForm->model()->xxx);
+ * @param $tabName
+ * @return mixed
+ */
+ public function setTabName($tabName)
+ {
+ return $this->tabName = $tabName;
+ }
+
+ public function getTabName()
+ {
+ if (is_null($this->tabName)) {
+ $this->tabName = $this->getKey();
+ }
+
+ return $this->tabName;
+ }
+
/**
* Set key for current form.
*