From 4138eda5cb6454789212d142de7654b28aca5edd Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Mon, 22 Jan 2024 20:15:26 +0100 Subject: [PATCH] Add Error method to I18nInput MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise, we can not show the error message to the user, although it assumes only the default language has error message, which is the case for now, but…. --- pkg/form/input.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/form/input.go b/pkg/form/input.go index 13e12a5..3d6c4b9 100644 --- a/pkg/form/input.go +++ b/pkg/form/input.go @@ -74,3 +74,12 @@ func (input I18nInput) FillArray(array database.RecordArray) error { } return nil } + +func (input I18nInput) Error() string { + for _, inner := range input { + if inner.Error != nil { + return inner.Error.Error() + } + } + return "" +}