Created
January 4, 2009 03:58
-
-
Save hiredman/43001 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn dd [x] | |
(print (str "<dd>" x "</dd>"))) | |
(defn next_button [] | |
(print "<dd class=\"next\"><input class=\"next\" value=\"Next\" type=\"submit\" /></dd>")) | |
(defn attribute_printer [attrs] | |
(foreach [attrs :as [k v]] | |
(if (and (not= k "") (not= "" v)) | |
(print (str k "=\"" v "\""))))) | |
(defn form_open [args] | |
(print (str "<form" (attribute_printer args) ">"))) | |
(defn form_close [] | |
(print "</form>\n")) | |
(defn selectbox [attrbs x] | |
(print "<select") | |
(attribute_printer attrbs) | |
(print ">\n") | |
(foreach [x :as [k v]] | |
(print (str "<option value=\"" value "\">" value "</option>\n"))) | |
(print "</select>\n")) | |
(defn input_field [attrbs box] | |
(if box | |
(print "<dd>")) | |
(print "<input ") | |
(if (not (array_key_exists "type" attrbs)) | |
(literal "$attrbs['type']=\"text\";")) | |
(if (and (array_key_exists (literal "$attrbs['name']") _POST) | |
(not array_key_exists "value" attrbs)) | |
(literal "$attrbs['value'] = $_POST[$attrbs['name']];")) | |
(attribute_printer attrbs) | |
(print ">") | |
(if box | |
(print "</dd>")) | |
(print "\n")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment