let MAKE-CHECKBOX-INPUT-FIELD accept a further argument: checked or

not
This commit is contained in:
interp 2002-10-04 15:29:50 +00:00
parent fbc10a2f63
commit 9fb5c80f65
2 changed files with 18 additions and 15 deletions

View File

@ -204,7 +204,7 @@ See the examples for further informations.
\defunx{make-number-input-field}{\ovar{default} \ovar{attributes}}{input-field} \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-textarea-input-field}{\ovar{default-text} \ovar{attributes}}{input-field}
\defunx{make-select-input-field}{options \ovar{multiple?} \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} \defunx{make-radio-input-fields}{values \ovar{attributes}}{input-fields}
\begin{desc} \begin{desc}
These functions generate various kind of \semvar{input-field}s. The 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 want to give the \attrib{cols} and \attrib{rows} attributes
explicitly. \ex{make-select-input-field} creates a select input explicitly. \ex{make-select-input-field} creates a select input
field of the items given in \semvar{options}. Depending on a given field of the items given in \semvar{options}. Depending on a given
\attrib{size} attribute the select input field will be displayed as a \attrib{size} attribute the select input field will be displayed as
scrollable list or a dropdown list (see a reference to HTML for a scrollable list or a dropdown list (see a reference to HTML for
details). If \semvar{multiple?} is true, the select input field will details). If \semvar{multiple?} is true, the select input field will
allow multiple selections. In this case, \ex{input-field-value} will allow multiple selections. In this case, \ex{input-field-value} will
return a (possibly empty) list of all selected items. Otherwise, the return a (possibly empty) list of all selected items. Otherwise, the
selected string is returned. \ex{make-checkbox-input-field} creats selected string is returned. \ex{make-checkbox-input-field} creates
a checkbox input field, optional with a value of \semvar{value}. If a checkbox input field, optionally with a value of
\semvar{value} is not given, the browser usually returns ``on''. \semvar{value}. If \semvar{value} is not given, the browser usually
\ex{make-radio-input-fields} is somewhat special as it returns a returns ``on''. If \semvar{checked?} has a true value, the checkbox
\emph{list} of radio button input fields. The reason is that radio will initially be checked. \ex{make-radio-input-fields} is somewhat
input fields must have the same name, but the text that surrounds special as it returns a \emph{list} of radio button input
the radio input fields is not included in the definition of the fields. The reason is that radio input fields must have the same
input field. \Ie{} you must split the resulting list up into its parts name, but the text that surrounds the radio input fields is not
and distribute them among your HTML text. The value of the included in the definition of the input field. \Ie{} you must split
\textit{n}th radio input field is the \textit{n}th element of the resulting list up into its parts and distribute them among your
\semvar{values}. HTML text. The value of the \textit{n}th radio input field is the
\textit{n}th element of \semvar{values}.
\end{desc} \end{desc}
\defun{make-submit-button}{\ovar{caption} \ovar{attributes}}{input-field} \defun{make-submit-button}{\ovar{caption} \ovar{attributes}}{input-field}

View File

@ -474,7 +474,8 @@
(define (make-checkbox-input-field . maybe-further-attributes) (define (make-checkbox-input-field . maybe-further-attributes)
(let* ((name (generate-input-field-name "checkbox"))) (let* ((name (generate-input-field-name "checkbox")))
(optionals maybe-further-attributes (optionals maybe-further-attributes
((value (lambda (a) (or (string? a) ((checked? boolean?)
(value (lambda (a) (or (string? a)
(number? a) (number? a)
(symbol? a)))) (symbol? a))))
(attributes XML-attribute?)) (attributes XML-attribute?))
@ -484,6 +485,7 @@
`(input (@ ((type "checkbox") `(input (@ ((type "checkbox")
(name ,name) (name ,name)
,(if value `(value ,value) '()) ,(if value `(value ,value) '())
,(if checked? '(checked) '())
,(and attributes (cdr attributes))))))))) ,(and attributes (cdr attributes)))))))))