[Bese-devel] Processing form input

Tiarnán Ó Corráin ocorrain at yahoo.com
Wed Feb 23 17:35:25 UTC 2005


Hi--

I'm playing around with UCW, with a view to using it for a website. I
seem to have run into a brick wall, though, and perusing the copious
documentation doesn't seem to help :-)

I've defined a form, and a render-on for it thus:

(defclass text-form (form-component)
  ((author-lastname :accessor author-lastname :component (text-field :size 50))
   (author-firstname :accessor author-firstname :component (text-field :size 50))
   (title :accessor title :component (text-area-field :rows 5 :cols 65))
   (publication-date :accessor pub-date :component (integer-field))
   (introduction :accessor intro :component (text-area-field :rows 20 :cols 65)))
  (:metaclass standard-component-class))

(defmethod render-on ((res response) (form text-form))
  (<ucw:form :action (submit form) :method "POST"
    (<:table
      (<:tr
        (<:td "Author's last name:")
        (<:td (render-on res (author-lastname form))))
      (<:tr
        (<:td "Author's first name:")
        (<:td (render-on res (author-firstname form))))
      (<:tr
        (<:td "Title:")
	(<:td (render-on res (title form))))
      (<:tr
        (<:td "Publication date:")
        (<:td (render-on res (pub-date form))))
      (<:tr
        (<:td :colspan 2 (<:h2 "Introduction to the text")))
      (<:tr
        (<:td :colspan 2 (render-on res (intro form))))
      (<:tr
        (<:td :colspan 3 (<:input :type "submit"))))))

Now I want to call a method to process what's entered, and dispatch
accordingly. I have tried defining a "submit" action:

(defaction submit ((f text-form))
  (<:h1 "Yo"))

And I expect to get a page with a large "Yo!" when I hit the submit
button, but I just get the form again (still filled out). I've tried
defining "submit" as a plain method, and an ":after" method, but still
no dice.

What am I missing?

-- 
Tiarnán



More information about the bese-devel mailing list