Beispiel #1
0
func FormErrors(ctx *app.Context, frm *form.Form) {
	errors := make(map[string]string)
	for _, v := range frm.Fields() {
		if ferr := v.Err(); ferr != nil {
			errors[v.HTMLName] = ferr.Error()
		}
	}
	data := map[string]interface{}{
		"errors": errors,
	}
	ctx.WriteJSON(data)
}