From 69c1453f830205e8e261a36c0ea330f0c75f274e Mon Sep 17 00:00:00 2001
From: James Cash <james.nvc@gmail.com>
Date: Sun, 11 Jan 2009 00:53:23 -0500
Subject: [PATCH 1/3] Adding a checkbox validator

---
 basis/validators/validators-docs.factor | 5 +++++
 basis/validators/validators.factor      | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/basis/validators/validators-docs.factor b/basis/validators/validators-docs.factor
index 4f03fa915b..42503a7155 100644
--- a/basis/validators/validators-docs.factor
+++ b/basis/validators/validators-docs.factor
@@ -2,6 +2,10 @@ USING: help.markup help.syntax io.streams.string quotations
 strings math regexp regexp.backend ;
 IN: validators
 
+HEPL: v-checkbox
+{ $values { "str" string } }
+{ $description "Converts the string value of a checkbox component (either \"on\" or \"off\") to a boolean value." } ;
+
 HELP: v-captcha
 { $values { "str" string } }
 { $description "Throws a validation error if the string is non-empty. This is used to create bait fields for spam-bots to fill in." } ;
@@ -99,6 +103,7 @@ $nl
 { $subsection v-one-line    }
 { $subsection v-one-word    }
 { $subsection v-captcha     }
+{ $subsection v-checkbox    }
 "More complex validators:"
 { $subsection v-email       }
 { $subsection v-url         }
diff --git a/basis/validators/validators.factor b/basis/validators/validators.factor
index 78e01fdaf7..755c9f9111 100644
--- a/basis/validators/validators.factor
+++ b/basis/validators/validators.factor
@@ -5,6 +5,9 @@ math.parser math.ranges assocs regexp unicode.categories arrays
 hashtables words classes quotations xmode.catalog ;
 IN: validators
 
+: v-checkbox ( str -- ? )
+    "on" = ;
+
 : v-default ( str def -- str/def )
     over empty? spin ? ;
 

From 0f2e0d077284623f92bd7adc8ed717693cb58ad8 Mon Sep 17 00:00:00 2001
From: James Cash <james.nvc@gmail.com>
Date: Sun, 11 Jan 2009 00:58:00 -0500
Subject: [PATCH 2/3] Fixing typo in docs for v-checkbox

---
 basis/validators/validators-docs.factor | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/basis/validators/validators-docs.factor b/basis/validators/validators-docs.factor
index 42503a7155..67c9f4fceb 100644
--- a/basis/validators/validators-docs.factor
+++ b/basis/validators/validators-docs.factor
@@ -2,7 +2,7 @@ USING: help.markup help.syntax io.streams.string quotations
 strings math regexp regexp.backend ;
 IN: validators
 
-HEPL: v-checkbox
+HELP: v-checkbox
 { $values { "str" string } }
 { $description "Converts the string value of a checkbox component (either \"on\" or \"off\") to a boolean value." } ;
 

From ab05d5b47d99fd5b51214b45c0c3d44daf1ad673 Mon Sep 17 00:00:00 2001
From: James Cash <james.nvc@gmail.com>
Date: Sun, 11 Jan 2009 01:11:06 -0500
Subject: [PATCH 3/3] Adding unit tests for v-checkbox

---
 basis/validators/validators-tests.factor | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/basis/validators/validators-tests.factor b/basis/validators/validators-tests.factor
index d4f3487d0b..acdcdda5d2 100644
--- a/basis/validators/validators-tests.factor
+++ b/basis/validators/validators-tests.factor
@@ -10,6 +10,9 @@ namespaces assocs ;
 [ "hello" ] [ "hello" v-one-word ] unit-test
 [ "hello world" v-one-word ] must-fail
 
+[ t ] [ "on" v-checkbox ] unit-test
+[ f ] [ "off" v-checkbox ] unit-test
+
 [ "foo" v-number ] must-fail
 [ 123 ] [ "123" v-number ] unit-test
 [ 123 ] [ "123" v-integer ] unit-test