[claw-cvs] r183 - trunk/doc/chapters

Andrea Chiumenti achiumenti at common-lisp.net
Tue Dec 30 17:43:46 UTC 2008


Author: achiumenti
Date: Tue Dec 30 17:43:45 2008
New Revision: 183

Log:


Modified:
   trunk/doc/chapters/claw-html.texinfo

Modified: trunk/doc/chapters/claw-html.texinfo
==============================================================================
--- trunk/doc/chapters/claw-html.texinfo	(original)
+++ trunk/doc/chapters/claw-html.texinfo	Tue Dec 30 17:43:45 2008
@@ -448,7 +448,7 @@
 
 Forms, submit buttons, and action links, may fire @code{ACTION-OBJECT} (whose default is the current page)  methods on submission, just before the page content rendering.
 
- at subsection You first form
+ at subsection Your first form
 
 All right, now it's time to build your first ``hello world'' form. To do so, you have to change your index.lisp file with the following code:
 
@@ -541,16 +541,47 @@
 A validator function if a function that accepts the @code{value} that is passed by the form component; if the validation fails, a validation
 error message is added to the variable @code{*validation-errors*}. The component @code{EXCEPTION-MONITOR} is given to show these validation errors.
 
+ at subsubsection Input server side validation and data translation
+
+Components may validate their input when they are provided with the @code{:VALIDATOR} attribute. This attribute designates a function that accept the value
+passed during form submission.
+
+When a component validation fails, the visitobject is not updated because the form doesn't complete it's rewind cycle phase.
+
 Currently the following validation functions are provided:
 
 @sp 1
 @itemize
- at item @code{VALIDATE-REQUIRED} 
+ at item @code{VALIDATE-REQUIRED (value &key (component (page-current-component *claw-current-page*)) message component-label)} 
 Checks if the required input field VALUE is present.  If not, a localizable message "Field ~a may not be empty." is sent with key "VALIDATE-REQUIRED".
 The argument for the message will be the @code{:LABEL} attribute of the COMPONENT.
- at item @code{VALIDATE-SIZE}
- at item @code{VALIDATE-RANGE}
- at item @code{VALIDATE-NUMBER}
- at item @code{VALIDATE-INTEGER}
- at item @code{VALIDATE-DATE-RANGE}
+ at item @code{VALIDATE-SIZE (value &key (component (page-current-component *claw-current-page*)) min-size max-size message-low message-hi component-label)}
+Checks if the input field VALUE legth is less then or greater then rispectively of the form keywords :MIN-SIZE and :MAX-SIZE.
+If less then :MIN-SIZE, a localizable message "Size of ~a may not be less then ~a chars." is sent with key "VALIDATE-SIZE-MIN".
+The argument for the message will be the :label attribute of the COMPONENT and the :MIN-ZIZE value.
+If greater then :MAX-SIZE, a localizable message "Size of ~a may not be more then ~a chars" is sent with key "VALIDATE-SIZE-MAX".
+The argument for the message will be the :label attribute of the COMPONENT and the :MAX-ZIZE value.
+ at item @code{VALIDATE-RANGE (value &key (component (page-current-component *claw-current-page*)) min max message-low message-hi component-label)}
+Checks if the numeric input field VALUE is less then or greater then rispectively of the form keywords :MIN and :MAX.
+If less then :MIN, a localizable message "Field ~a is not less then or equal to ~d." is sent with key "VALIDATE-RANGE-MIN".
+The argument for the message will be the :label attribute of the COMPONENT and the :MIN value.
+If greater then :MIN, a localizable message "Field ~a is not greater then or equal to ~d." is sent with key "VALIDATE-RANGE-MAX".
+The argument for the message will be the :label attribute of the COMPONENT and the :MAX value.
+ at item @code{VALIDATE-NUMBER (value &key (component (page-current-component *claw-current-page*)) min max message-nan message-low message-hi component-label)}
+Checks if the input field VALUE is a valid number and then passes the validation to VALIDATION-RANGE.
+If not a number, a localizable message "Field ~a is not a valid number." is sent with key "VALIDATE-NUMBER".
+The argument for the message will be the :label attribute of the COMPONENT.
+ at item @code{VALIDATE-INTEGER (value &key (component (page-current-component *claw-current-page*)) min max message-nan message-low message-hi component-label)}
+Checks if the input field VALUE is a valid number and then passes the validation to VALIDATION-RANGE.
+If not a number, a localizable message "Field ~a is not a valid integer." is sent with key "VALIDATE-INTEGER".
+The argument for the message will be the :label attribute of the COMPONENT.
+ at item @code{VALIDATE-DATE-RANGE (value &key (component (page-current-component *claw-current-page*)) min max (use-date-p t) use-time-p message-low message-hi component-label)}
+Checks if the input field VALUE is a date between min and max.
+If :USE-DATE-P is not nil and :USE-TIME-P is nil, validation is made without considering the time part of local-time.
+If :USE-DATE-P nil and :USE-TIME-P is not nil, validation is made without considering the date part of local-time.
+If :USE-DATE-P and :USE-TIME-P are both not nil or nil, validation is made considering the date and time part of local-time.
+If value is less then the date passed to :MIN, a localizable message "Field ~a is less then ~a." is sent with key "VALIDATE-DATE-RANGE-MIN".
+The argument for the message will be the :label attribute of the COMPONENT and the value passed to :MIN parsed with the :LOCAL-TIME-FORMAT keyword.
+If value is greater then the date passed to :MAX, a localizable message "Field ~a is greater then ~a." is sent with key "VALIDATE-DATE-RANGE-MAX".
+The argument for the message will be the :label attribute of the COMPONENT and the value passed to :MAX parsed with the :LOCAL-TIME-FORMAT keyword.
 @end itemize




More information about the Claw-cvs mailing list