Added form field statuses during validation.

This commit is contained in:
mikestefanello 2021-12-23 08:57:27 -05:00
parent 57159c4fba
commit d6ef2b0b73
6 changed files with 37 additions and 13 deletions

View file

@ -27,10 +27,10 @@ func (c *Contact) Get(ctx echo.Context) error {
p.Layout = "main"
p.Name = "contact"
p.Title = "Contact us"
p.Data = ContactForm{}
p.Form = ContactForm{}
if form := ctx.Get(context.FormKey); form != nil {
p.Data = form.(ContactForm)
p.Form = form.(ContactForm)
}
return c.RenderPage(ctx, p)
@ -59,7 +59,7 @@ func (c *Contact) Post(ctx echo.Context) error {
return c.Get(ctx)
}
htmx := controller.NewHTMXRequest(ctx)
htmx := controller.GetHTMXRequest(ctx)
if htmx.Enabled {
return ctx.String(http.StatusOK, "<b>HELLO!</b>")