// Same as BaseFormFromModel but returns a Bootstrap3 compatible form. func BootstrapFormFromModel(m interface{}, method, action string) *Form { form := BootstrapForm(method, action) for _, v := range unWindStructure(m, "") { form.Elements(v) } form.Elements(fields.SubmitButton("submit", "Submit")) return form }
func TestInlineCreation(t *testing.T) { form := BaseForm(POST, "/action.html").Elements( fields.TextField("text_field").SetLabel("Username"), FieldSet("psw_fieldset", fields.PasswordField("psw1").AddClass("password_class").SetLabel("Password 1"), fields.PasswordField("psw2").AddClass("password_class").SetLabel("Password 2"), ), fields.SubmitButton("btn1", "Submit"), ) t.Log("Rendered form:", form.Render()) }
func TestButtonRender(t *testing.T) { field := fields.SubmitButton("btn", "Click me!") field.SetStyle(style) t.Log("Rendered button:", field.Render()) btn = field }