Пример #1
0
// 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
}
Пример #2
0
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())
}
Пример #3
0
func TestButtonRender(t *testing.T) {
	field := fields.SubmitButton("btn", "Click me!")
	field.SetStyle(style)
	t.Log("Rendered button:", field.Render())
	btn = field
}