]> saetta.ns0.it Git - zakegg_go/commitdiff
Non riassegnava il valore float dopo pulitura. master
authorAndrea Zagli <azagli@libero.it>
Thu, 22 Sep 2022 15:23:21 +0000 (17:23 +0200)
committerAndrea Zagli <azagli@libero.it>
Thu, 22 Sep 2022 15:23:21 +0000 (17:23 +0200)
form.go

diff --git a/form.go b/form.go
index de746a8426999181e069d7651c98a782dbb6cb02..a0ed3f510891ebcdd4df04824991176c65441ef1 100644 (file)
--- a/form.go
+++ b/form.go
@@ -194,10 +194,6 @@ func CreaMapValidator(elems map[string]*FormElement, r *http.Request) (map[strin
        valori := make(map[string]interface{})
        regole := make(map[string]interface{})
        for _, elem := range elems {
-               /*if elem.Name == "IDAssociazioni" {
-                       i, _ := strconv.Atoi(r.FormValue(elem.Name))
-                       valori[elem.Name] = i
-               } else {*/
                if elem.Filter != "" {
                        splitted := strings.Split(elem.Filter, ",")
                        for _, f := range splitted {
@@ -234,6 +230,8 @@ func CreaMapDb (elems map[string]*FormElement) (map[string]interface{}) {
                                v, _ := strconv.ParseFloat(str, 64)
                                if elem.DBType == "int" || strings.Contains(elem.Validation, "numeric_it=int") {
                                        campi[elem.DBName] = int(v)
+                               } else {
+                                       campi[elem.DBName] = v
                                }
                        } else if strings.Contains(elem.Validation, "mydate") {
                                /* metto la data in formato sql */