func (r *FormRenderer) BeginField(w io.Writer, field *form.Field) error { attrs := html.Attrs{"class": "form-group"} if field.Err() != nil { attrs["class"] += " has-error" } div := html.Div() div.Attrs = attrs div.Open = true _, err := div.WriteTo(w) if err == nil && field.Type == form.CHECKBOX { cb := html.Div() cb.Attrs = html.Attrs{"class": "checkbox"} cb.Open = true _, err = cb.WriteTo(w) } return err }