func GenChoices(lenType interface{}, fnType interface{}) interface{} {
	switch fn := fnType.(type) {
	case func(int) (string, string, bool):
		length, ok := lenType.(int)
		if !ok {
			return []fields.InputChoice{}
		}
		result := make([]fields.InputChoice, length)
		for key, r := range result {
			r.ID, r.Val, r.Checked = fn(key)
			result[key] = r
		}
		return result
	case func(string, int) (string, string, bool):
		result := make(map[string][]fields.InputChoice)
		values, ok := lenType.(map[string]int)
		if !ok {
			return result
		}
		for group, length := range values {
			if _, ok := result[group]; !ok {
				result[group] = make([]fields.InputChoice, length)
			}
			for key, r := range result[group] {
				r.ID, r.Val, r.Checked = fn(group, key)
				result[group][key] = r
			}
		}
		return result
	}
	return nil
}
GenChoices generate choices
type Data struct{
ID string
Name string
}
data:=[]*Data{
&Data{ID:"a",Name:"One"},
&Data{ID:"b",Name:"Two"},
}
GenChoices(len(data), func(index int) (string, string, bool){
return data[index].ID,data[index].Name,false
})
or
GenChoices(map[string]int{
"":len(data),
}, func(group string,index int) (string, string, bool){
return data[index].ID,data[index].Name,false
})
package forms
import (
	"github.com/coscms/forms/config"
	"github.com/coscms/forms/fields"
)
type ElementSetter interface {
	Elements(...config.FormElement)
}
func NewConfig() *config.Config {
	return &config.Config{
		ID:       `Forms`,
		Theme:    `bootstrap3`,
		Template: ``,
		Method:   `POST`,
		Attributes: [][]string{
			[]string{"class", "form-horizontal"},
			[]string{"role", "form"},
		},
		WithButtons: true,
		Buttons:     make([]string, 0),
		Elements:    make([]*config.Element, 0),
	}
}