From 1ab48d2947fb7efec6c55cd6f2414c703980c8d8 Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Mon, 13 Mar 2023 14:55:10 +0100 Subject: [PATCH] Add the String() method to InputField --- pkg/form.go | 4 ++++ web/template/products/edit.gohtml | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/form.go b/pkg/form.go index 117447c..bd96807 100644 --- a/pkg/form.go +++ b/pkg/form.go @@ -74,6 +74,10 @@ func (field *InputField) Float64() float64 { return value } +func (field *InputField) String() string { + return field.Val +} + type SelectOption struct { Value string Label string diff --git a/web/template/products/edit.gohtml b/web/template/products/edit.gohtml index aa36815..2fd3085 100644 --- a/web/template/products/edit.gohtml +++ b/web/template/products/edit.gohtml @@ -1,5 +1,5 @@ {{ define "title" -}} - {{printf (pgettext "Edit Product “%s”" "title") .Name.Val }} + {{printf (pgettext "Edit Product “%s”" "title") .Name }} {{- end }} {{ define "content" }} @@ -8,11 +8,11 @@

{{( pgettext "Home" "title" )}} / {{( pgettext "Products" "title" )}} / - {{ .Name.Val }} + {{ .Name }}

-

{{printf (pgettext "Edit Product “%s”" "title") .Name.Val }}

+

{{printf (pgettext "Edit Product “%s”" "title") .Name }}

{{ csrfToken }} {{ putMethod }}