Browse Source

add GetChecked method to verify checkbox field status

Bozhin Zafirov 8 years ago
parent
commit
572cd1c598
1 changed files with 6 additions and 0 deletions
  1. 6 0
      forms.go

+ 6 - 0
forms.go

@@ -41,3 +41,9 @@ func (f FormField) GetBool() (bool, error) {
 	// placeholder
 	return false, nil
 }
+
+// GetChecked returns true if checkbox has been selected
+// only works if checkbox value is "on" when selected
+func (f FormField) GetChecked() bool {
+	return f.Value == "on"
+}