]> saetta.ns0.it Git - zakegg_go/commitdiff
I FormElement senza DBName vanno esclusi dalla creazione del map per le operazioni...
authorAndrea Zagli <azagli@libero.it>
Wed, 10 Aug 2022 09:02:13 +0000 (11:02 +0200)
committerAndrea Zagli <azagli@libero.it>
Wed, 10 Aug 2022 09:02:13 +0000 (11:02 +0200)
form.go

diff --git a/form.go b/form.go
index dcf6146e4c386f64769314bea1b01dda790f7ca4..e61a48599e887b0a34844ae06416e9d7b4744dfa 100644 (file)
--- a/form.go
+++ b/form.go
@@ -188,12 +188,14 @@ func CreaMapValidator(elems map[string]*FormElement, r *http.Request) (map[strin
 func CreaMapDb (elems map[string]*FormElement) (map[string]interface{}) {
        campi := make(map[string]interface{})
        for _, elem := range elems {
-               if strings.Contains(elem.Validation, "numeric_it") {
-                       /* tolgo la formattazione */
-                       campi[elem.DBName] = strings.ReplaceAll(elem.Value, ".", "")
-                       campi[elem.DBName] = strings.ReplaceAll(campi[elem.DBName].(string), ",", ".")
-               } else {
-                       campi[elem.DBName] = elem.Value
+               if elem.DBName != "" {
+                       if strings.Contains(elem.Validation, "numeric_it") {
+                               /* tolgo la formattazione */
+                               campi[elem.DBName] = strings.ReplaceAll(elem.Value, ".", "")
+                               campi[elem.DBName] = strings.ReplaceAll(campi[elem.DBName].(string), ",", ".")
+                       } else {
+                               campi[elem.DBName] = elem.Value
+                       }
                }
        }