From efbc295ba2c4e5e30f358ac28afccaf243bc6298 Mon Sep 17 00:00:00 2001 From: Tornike Razmadze Date: Mon, 26 Jun 2017 22:02:08 +0400 Subject: fixed problem with saving multiple repeaters closes #59 closes #167 --- system/api/create.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'system/api/create.go') diff --git a/system/api/create.go b/system/api/create.go index 3b748cc..8af415b 100644 --- a/system/api/create.go +++ b/system/api/create.go @@ -83,7 +83,6 @@ func createContentHandler(res http.ResponseWriter, req *http.Request) { // and correctly format for db storage. Essentially, we need // fieldX.0: value1, fieldX.1: value2 => fieldX: []string{value1, value2} fieldOrderValue := make(map[string]map[string][]string) - ordVal := make(map[string][]string) for k, v := range req.PostForm { if strings.Contains(k, ".") { fo := strings.Split(k, ".") @@ -91,7 +90,9 @@ func createContentHandler(res http.ResponseWriter, req *http.Request) { // put the order and the field value into map field := string(fo[0]) order := string(fo[1]) - fieldOrderValue[field] = ordVal + if len(fieldOrderValue[field]) == 0 { + fieldOrderValue[field] = make(map[string][]string) + } // orderValue is 0:[?type=Thing&id=1] orderValue := fieldOrderValue[field] -- cgit v1.2.3