]> saetta.ns0.it Git - zakegg_go/commitdiff
Aggiunto filtro trim.
authorAndrea Zagli <azagli@libero.it>
Thu, 11 Aug 2022 12:06:34 +0000 (14:06 +0200)
committerAndrea Zagli <azagli@libero.it>
Thu, 11 Aug 2022 12:06:34 +0000 (14:06 +0200)
form.go

diff --git a/form.go b/form.go
index cbffd011843908d64a3f84f47661306f50b7355a..4b915062cb2e38c552ed8cdffd4b5f5484eaea82 100644 (file)
--- a/form.go
+++ b/form.go
@@ -181,6 +181,9 @@ func CreaMapValidator(elems map[string]*FormElement, r *http.Request) (map[strin
                                case "uppercase":
                                        elem.Value = strings.ToUpper(r.FormValue(elem.Name))
                                        valori[elem.Name] = elem.Value
+                               case "trim":
+                                       elem.Value = strings.Trim(r.FormValue(elem.Name), " ")
+                                       valori[elem.Name] = elem.Value
                                }
                        }
                } else {