This is an example of a form with inline, server-side validation and HTMX-powered AJAX submissions without writing a single line of JavaScript.
Only the form below will update async upon submission.
package pages import ( "git.grosinger.net/tgrosinger/saasitone/templ/components" "git.grosinger.net/tgrosinger/saasitone/pkg/form" "git.grosinger.net/tgrosinger/saasitone/pkg/page" ) type ContactForm struct { Email string `form:"email" validate:"required,email"` Department string `form:"department" validate:"required,oneof=sales marketing hr"` Message string `form:"message" validate:"required"` form.Submission } templ Contact(p page.Page, f *ContactForm) { if p.HTMX.Request.Target != "contact" {
} } } if f.IsDone() { } else {