diff --git a/scheme/httpd/surflets/latex/surflet.tex b/scheme/httpd/surflets/latex/surflet.tex index 1981c99..047d0d1 100644 --- a/scheme/httpd/surflets/latex/surflet.tex +++ b/scheme/httpd/surflets/latex/surflet.tex @@ -204,7 +204,7 @@ See the examples for further informations. \defunx{make-number-input-field}{\ovar{default} \ovar{attributes}}{input-field} \defunx{make-textarea-input-field}{\ovar{default-text} \ovar{attributes}}{input-field} \defunx{make-select-input-field}{options \ovar{multiple?} \ovar{attributes}}{input-field} -\defunx{make-checkbox-input-field}{\ovar{value} \ovar{attributes}}{input-field} +\defunx{make-checkbox-input-field}{\ovar{checked?} \ovar{value} \ovar{attributes}}{input-field} \defunx{make-radio-input-fields}{values \ovar{attributes}}{input-fields} \begin{desc} These functions generate various kind of \semvar{input-field}s. The @@ -226,22 +226,23 @@ See the examples for further informations. want to give the \attrib{cols} and \attrib{rows} attributes explicitly. \ex{make-select-input-field} creates a select input field of the items given in \semvar{options}. Depending on a given - \attrib{size} attribute the select input field will be displayed as a - scrollable list or a dropdown list (see a reference to HTML for + \attrib{size} attribute the select input field will be displayed as + a scrollable list or a dropdown list (see a reference to HTML for details). If \semvar{multiple?} is true, the select input field will allow multiple selections. In this case, \ex{input-field-value} will return a (possibly empty) list of all selected items. Otherwise, the - selected string is returned. \ex{make-checkbox-input-field} creats - a checkbox input field, optional with a value of \semvar{value}. If - \semvar{value} is not given, the browser usually returns ``on''. - \ex{make-radio-input-fields} is somewhat special as it returns a - \emph{list} of radio button input fields. The reason is that radio - input fields must have the same name, but the text that surrounds - the radio input fields is not included in the definition of the - input field. \Ie{} you must split the resulting list up into its parts - and distribute them among your HTML text. The value of the - \textit{n}th radio input field is the \textit{n}th element of - \semvar{values}. + selected string is returned. \ex{make-checkbox-input-field} creates + a checkbox input field, optionally with a value of + \semvar{value}. If \semvar{value} is not given, the browser usually + returns ``on''. If \semvar{checked?} has a true value, the checkbox + will initially be checked. \ex{make-radio-input-fields} is somewhat + special as it returns a \emph{list} of radio button input + fields. The reason is that radio input fields must have the same + name, but the text that surrounds the radio input fields is not + included in the definition of the input field. \Ie{} you must split + the resulting list up into its parts and distribute them among your + HTML text. The value of the \textit{n}th radio input field is the + \textit{n}th element of \semvar{values}. \end{desc} \defun{make-submit-button}{\ovar{caption} \ovar{attributes}}{input-field} diff --git a/scheme/httpd/surflets/surflets.scm b/scheme/httpd/surflets/surflets.scm index e66acd4..cbedbfe 100644 --- a/scheme/httpd/surflets/surflets.scm +++ b/scheme/httpd/surflets/surflets.scm @@ -474,7 +474,8 @@ (define (make-checkbox-input-field . maybe-further-attributes) (let* ((name (generate-input-field-name "checkbox"))) (optionals maybe-further-attributes - ((value (lambda (a) (or (string? a) + ((checked? boolean?) + (value (lambda (a) (or (string? a) (number? a) (symbol? a)))) (attributes XML-attribute?)) @@ -484,6 +485,7 @@ `(input (@ ((type "checkbox") (name ,name) ,(if value `(value ,value) '()) + ,(if checked? '(checked) '()) ,(and attributes (cdr attributes)))))))))