((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/html-form" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "egg")) (section 2 "html-form" (toc) (section 3 "Introduction" (p "The " (tt "html-form") " library is intended to construct HTML form descriptions in an s-expression syntax that are then passed to an HTML generation routine.")) (section 3 "Library procedures" (def (sig (procedure "html-form:: SPEC -> SXML" (id html-form))) (p "This is the only exported routine in this egg. Given a form specification, returns an SXML document containing an HTML form. " (tt "SPEC") " is an s-expression with the following grammar:") (pre " SPEC = (form-group NAME [(label LABEL)] (children ...) ) \n        | WIDGET") (pre " WIDGET =     (checkbox NAME DFLT [(label LABEL)] [(rel REL)] ) \n              (textarea NAME DFLT (rows N) (cols N) [(label LABEL)] [(rel REL)] ) \n              (select   NAME DFLT [(label LABEL)] [(rel REL)] ) \n              (button   NAME DFLT [(label LABEL)] [(rel REL)] [(onclick STRING)] )\n              (radio    NAME DFLT [(label LABEL)] [(rel REL)] ( (RNAME ROPTS) ... ) )\n              (text     NAME DFLT [(label LABEL)] [(rel REL)] )") (p (tt "NAME") ", " (tt "LABEL") " and " (tt "REL") " are symbols or strings. " (tt "DFLT") " is the default value of an input, or a list of values in the case of " (tt "textarea") " and " (tt "select") "."))) (section 3 "Example" (pre "(use html-form)") (pre "(define Country-List\n `(\"Afghanistan\"\n   \"Albania\"\n   \"Algeria\"\n   \"American Samoa\"\n   \"Andorra\"\n   ))") (pre "(define form-variables\n `(\n   (form-group Personal-Data (label \"Personal Data\")\n               (children \n                (First-Name         \"\"  (label \"First Name * \"))\n                (Last-Name          \"\"  (label \"Last Name * \"))\n                (email              \"\"  (label \"Email address * \"))\n                (Nationality        \"\"  (label \"Nationality *\")\n                                    (select ,Country-List))\n                (Birth-Year         \"\"\n                                    (label \"Year of birth *\")\n                                    (select ,(list-tabulate 50 (lambda (i) (number->string (+ 1940 i))))))\n                (Gender             \"\" \n                                    (label \"Gender *\")\n                                    (select (\"Female\" \"Male\")))\n                ))") (pre "   (form-group   Education (label \"Education & professional background\")\n                 (children \n                  (Degree     \"\" (label \"Last degree obtained \")\n                                 (select \n                                    (\"Bachelor of Science\"\n                                     \"Master of Science\"\n                                     \"Ph.D.\"\n                                     \"Current undergraduate student\")))\n                  (Major      \"\" (label \"Academic major \")\n                                 (select \n                                    (\"Artificial Intelligence\"\n                                     \"Biochemistry\"\n                                     \"Biology\"\n                                     \"Biomedicine\"\n                                     \"Other\")))\n                  (Degree-Other \"\"   (label \"Degree obtained if other \"))\n                  (Education-History \"\"  \n                                     (label \"Education history\")\n                                     (hint \"Please list year, institution, and highest degree obtained. \")\n                                     (textarea (rows 10) (cols 60)))\n                  ))))") (pre "  (pretty-print (map (lambda (x) (html-form x)) form-variables))")) (section 3 "Author" (p (int-link "/users/ivan-raikov" "Ivan Raikov"))) (section 3 "Version" (dl (dt "1.4") (dd "checkbox fixes") (dt "1.3") (dd "Added functionality for multiple selections") (dt "1.2.1") (dd "Use of setup-api 'copy-file' [Kon Lovett]") (dt "1.1") (dd "Ported to Chicken 4") (dt "1.0") (dd "Initial version"))) (section 3 "License" (pre "Copyright 2008-2011 Ivan Raikov and the Okinawa Institute of Science\nand Technology.\n\n{{html-form}} is distributed along with the wFORMS 2.0 Stylesheet,\ncopyright 2005-2006 Cedric Savarese (http://www.4213miles.com).\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nA full copy of the GPL license can be found at\n<http://www.gnu.org/licenses/>."))))