bluele/gforms — pull request #3 by gavbaa (2014-08-27 21:00:14+00:00)
Title: TextWidget now reuses the last submitted value.

Currently, TextWidget won't use the value from a previous submission of the form. I'm not 100% comfortable with my solution, as the iterating to display values for a field that should likely never be an actual array seems a little hokey. But, that's the data type getting passed to the widget, so I stuck with it.

Here was my example form that I triggered this with:

loginForm := gforms.DefineForm(gforms.NewFields(
gforms.NewTextField("Username",
gforms.Validators{
gforms.Required(),
},
gforms.NewTextWidget(map[string]string{"class": "form-control"}),
),
gforms.NewTextField("Password",
gforms.Validators{
gforms.Required(),
gforms.MinLengthValidator(1),
},
gforms.NewTextWidget(map[string]string{"class": "form-control"}),
),
))