Skip to content

Instantly share code, notes, and snippets.

@hiredman
Created January 4, 2009 03:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiredman/43001 to your computer and use it in GitHub Desktop.
Save hiredman/43001 to your computer and use it in GitHub Desktop.
(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