Skip to content

Instantly share code, notes, and snippets.

@r-moeritz
Created June 16, 2011 18:05
Show Gist options
  • Save r-moeritz/1029835 to your computer and use it in GitHub Desktop.
Save r-moeritz/1029835 to your computer and use it in GitHub Desktop.
new-game function
(define-url-fn (new-game)
(standard-page (:title "Add a new game")
(:script :type "text/javascript"
(str (ps
(defun validate ()
(when (= (@ ((@ document get-element-by-id) "name") value) "")
(alert "Please enter a name.")
(return false))))))
(:h1 "Add a new game to the chart")
(:form :action "/game-added.htm" :method "post"
:onsubmit (ps-inline (validate))
(:p "What is the name of the game?" (:br)
(:input :type "text"
:id "name"
:name "name"
:class "txt"))
(:p (:input :type "submit"
:value "Add"
:class "btn")))
(:p (:a :href "retro-games.htm" "Back to list"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment