1 USING: help.markup help.syntax io.streams.string quotations
2 strings math regexp regexp.backend ;
6 { $values { "str" string } { "?" "a boolean" } }
7 { $description "Converts the string value of a checkbox component (either \"on\" or \"off\") to a boolean value." } ;
10 { $values { "str" string } }
11 { $description "Throws a validation error if the string is non-empty. This is used to create bait fields for spam-bots to fill in." } ;
14 { $values { "str" string } { "n" integer } }
15 { $description "If the credit card number passes the Luhn algorithm, converts it to an integer, otherwise throws an error." }
16 { $notes "See " { $url "http://en.wikipedia.org/wiki/Luhn_algorithm" } " for a description of this algorithm." } ;
19 { $values { "str" string } { "def" string } { "str/def" string } }
20 { $description "If the input string is not specified, replaces it with the default value." } ;
23 { $values { "str" string } }
24 { $description "Throws a validation error if the string is not a valid e-mail address, as determined by a regular expression." } ;
27 { $values { "str" string } { "n" integer } }
28 { $description "Converts the string into an integer, throwing a validation error if the string is not a valid integer." } ;
31 { $values { "str" string } { "n" integer } }
32 { $description "Throws a validation error if the string is shorter than " { $snippet "n" } " characters." } ;
35 { $values { "str" string } { "n" integer } }
36 { $description "Throws a validation error if the string is longer than " { $snippet "n" } " characters." } ;
39 { $values { "x" integer } { "n" integer } }
40 { $description "Throws an error if " { $snippet "x" } " is larger than " { $snippet "n" } "." } ;
43 { $values { "x" integer } { "n" integer } }
44 { $description "Throws an error if " { $snippet "x" } " is smaller than " { $snippet "n" } "." } ;
47 { $values { "str" string } }
48 { $description "Throws an error if " { $snippet "str" } " is not a valid XMode mode name." } ;
51 { $values { "str" string } { "n" real } }
52 { $description "Converts the string into a real number, throwing a validation error if the string is not a valid real number." } ;
55 { $values { "str" string } }
56 { $description "Throws a validation error if the string contains line breaks." } ;
59 { $values { "str" string } }
60 { $description "Throws a validation error if the string contains word breaks." } ;
63 { $values { "str" string } { "quot" quotation } { "result" string } }
64 { $description "If the string is non-empty, applies the quotation to the string, otherwise outputs the empty string." } ;
67 { $values { "str" string } }
68 { $description "A reasonable default validator for passwords." } ;
71 { $values { "str" string } { "what" string } { "regexp" regexp } }
72 { $description "Throws a validation error that " { $snippet "what" } " failed if the string does not match the regular expression." } ;
75 { $values { "str" string } }
76 { $description "Throws a validation error if the string is empty." } ;
79 { $values { "str" string } }
80 { $description "Throws an error if the string is not a valid URL, as determined by a regular expression." } ;
83 { $values { "str" string } }
84 { $description "A reasonable default validator for usernames." } ;
86 ARTICLE: "validators" "Form validators"
87 "The " { $vocab-link "validators" } " vocabulary provides a set of words which are intended to be used with the form validation functionality offered by " { $vocab-link "furnace.actions" } ". They can also be used independently of the web framework."
89 "Note that validators which take numbers must be preceded by " { $link v-integer } " or " { $link v-number } " if the original input is a string."
91 "Higher-order validators which require additional parameters:"
92 { $subsection v-default }
93 { $subsection v-optional }
94 { $subsection v-min-length }
95 { $subsection v-max-length }
96 { $subsection v-min-value }
97 { $subsection v-max-value }
98 { $subsection v-regexp }
100 { $subsection v-required }
101 { $subsection v-number }
102 { $subsection v-integer }
103 { $subsection v-one-line }
104 { $subsection v-one-word }
105 { $subsection v-captcha }
106 { $subsection v-checkbox }
107 "More complex validators:"
108 { $subsection v-email }
109 { $subsection v-url }
110 { $subsection v-username }
111 { $subsection v-password }
112 { $subsection v-credit-card }
113 { $subsection v-mode } ;