constructors.go 503 B

1234567891011121314
  1. package form
  2. // Generate new CharField field with type text
  3. func NewCharField(Name, Label string, Value *string, Validators *ValidatorsList) FormField {
  4. if Value == nil {
  5. return FormField{Name, "text", Label, "", nil, Validators}
  6. }
  7. return FormField{Name, "text", Label, *Value, nil, Validators}
  8. }
  9. // Generate new CharField field with type password
  10. func NewPasswordField(Name, Label string, Validators *ValidatorsList) FormField {
  11. return FormField{Name, "password", Label, "", nil, Validators}
  12. }