package builder import ( "html" "golang-fave/engine/utils" "golang-fave/engine/wrapper" ) const ( DFKHidden = iota DFKText DFKNumber DFKEmail DFKPassword DFKTextArea DFKCheckBox DFKSubmit DFKMessage ) type DataFormField struct { Caption string Kind int Name string Value string Placeholder string Hint string Target string Required bool Classes string Min string Max string CallBack func(field *DataFormField) string } func DataForm(wrap *wrapper.Wrapper, data []DataFormField) string { var html_hidden string var html_element string var html_message string var html_button string for i, field := range data { if field.Kind == DFKHidden { if field.CallBack != nil { html_hidden += field.CallBack(&field) } else { html_hidden += `` } } else if field.Kind != DFKHidden && field.Kind != DFKSubmit && field.Kind != DFKMessage { if field.CallBack != nil { html_element += field.CallBack(&field) } else { required := `` if field.Required { required = ` required` } classes := field.Classes if classes != "" { classes = " " + classes } html_element += `