You are looking at historical revision 12779 of this page. It may differ significantly from its current revision.
The html-form library is intended to construct HTML form descriptions in an s-expression syntax that are then passed to an HTML generation routine.
html-form:: SPEC -> SXML
This is the only exported routine in this egg. Given a form specification, returns an SXML document containing an HTML form. SPEC is an s-expression with the following grammar:
SPEC = (form-group NAME [(label LABEL)] (children ...) ) | WIDGET
WIDGET = (checkbox NAME DFLT [(label LABEL)] [(rel REL)] ) (textarea NAME DFLT (rows N) (cols N) [(label LABEL)] [(rel REL)] ) (select NAME DFLT [(label LABEL)] [(rel REL)] ) (button NAME DFLT [(label LABEL)] [(rel REL)] [(onclick STRING)] ) (radio NAME DFLT [(label LABEL)] [(rel REL)] ( (RNAME ROPTS) ... ) ) (text NAME DFLT [(label LABEL)] [(rel REL)] )
NAME, LABEL and REL are symbols or strings. DFLT is the default value of an input, or a list of values in the case of textarea and select.
(define Country-List `("Afghanistan" "Albania" "Algeria" "American Samoa" "Andorra" ))
(define form-variables `( (form-group Personal-Data (label "Personal Data") (children (First-Name "" (label "First Name * ")) (Last-Name "" (label "Last Name * ")) (email "" (label "Email address * ")) (Nationality "" (label "Nationality *") (select ,Country-List)) (Birth-Year "" (label "Year of birth *") (select ,(list-tabulate 50 (lambda (i) (number->string (+ 1940 i)))))) (Gender "" (label "Gender *") (select ("Female" "Male"))) ))
(form-group Education (label "Education & professional background") (children (Degree "" (label "Last degree obtained ") (select ("Bachelor of Science" "Master of Science" "Ph.D." "Current undergraduate student"))) (Major "" (label "Academic major ") (select ("Artificial Intelligence" "Biochemistry" "Biology" "Biomedicine" "Other"))) (Degree-Other "" (label "Degree obtained if other ")) (Education-History "" (label "Education history") (hint "Please list year, institution, and highest degree obtained. ") (textarea (rows 10) (cols 60))) ))))
- Initial version
Copyright 2008 Ivan Raikov and the Okinawa Institute of Science and Technology.
html-form is distributed along with the wFORMS 2.0 Stylesheet, copyright 2005-2006 Cedric Savarese (http://www.4213miles.com).
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A full copy of the GPL license can be found at <http://www.gnu.org/licenses/>.