Answer the question
In order to leave comments, you need to log in
How to make error text return in html/template when checking variable?
Greetings!
I use the Echo framework and unfortunately I'm completely confused, I'll try to explain from what I have at the moment.
func GetHandler(c echo.Context) error {
return c.Render(200, "login.html", echo.Map{
"Title": "Новая запись",
})
}
func PostHandler(c echo.Context) error {
name := c.FormValue("name")
if len(name) == 0 {
return c.Render(200, "login.html", echo.Map{
"Title": "Новая запись",
"Error": "Вы не ввели название",
})
}
}
if len(attr.Name) == 0 {
helpers.FlashError(c, "Короткое сообщение")
return c.Redirect(302, c.Request().URL.Path)
}
Answer the question
In order to leave comments, you need to log in
If it is useful to someone else - https://www.alexedwards.net/blog/simple-flash-mess...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question