[Bese-devel] How to return multiple values from a form...

Alberto Santini albertosantini at gmail.com
Wed May 17 20:01:05 UTC 2006


Hello.

A newbie question.

The code included runs, but it doesn't work fine.

I would like to pass pgn-title and pgn-string values to
the second page/component, but I cannot write something
in the form element:
...
 (ok window pgn-title pgn-string)
...

So, of course, I'm missing something or, maybe, I have to switch
to another approach: maybe I have to use an instance of simple-form
component.

Thanks in advance,
Alberto Santini


--------------------------------------
(in-package :cl-user)

(defpackage :it.albertosantini.chessweb
  (:use :common-lisp
	:it.bese.ucw))

(in-package :it.albertosantini.chessweb)

(defvar *chessweb-app*
  (make-instance 'cookie-session-application :url-prefix "/chessweb/"))

(register-application *default-server* *chessweb-app*)

(defentry-point "index.ucw" (:application *chessweb-app*) ()
  (loop
     (multiple-value-bind (pgn-title pgn-string) (call 'pgn-publisher)
       (call 'create-html-pgn :pgn-title pgn-title :pgn-string pgn-string))))

(defcomponent pgn-publisher (simple-window-component)
  ()
  (:default-initargs :title "ChessWeb Publisher"))

(defmethod render ((window pgn-publisher))
  (<:h1 "ChessWeb Publisher")
  (let ((pgn-title "")
	(pgn-string ""))
    (<ucw:form :action (ok window pgn-string)
	       (<:as-html "PGN Page Title: ")
	       (<ucw:input :accessor pgn-title)
	       (<:br)
	       (<ucw:textarea :accessor pgn-string :rows 10 :cols 64)
	       (<:br)
	       (<:submit :value "Publish"))))

(defcomponent create-html-pgn (simple-window-component)
  ((pgn-title :accessor pgn-title :initarg :pgn-title)
   (pgn-string :accessor pgn-string :initarg :pgn-string))
  (:default-initargs :title "ChessWeb Page"))

(defmethod render ((window create-html-pgn))
  (<:h1 (pgn-title window))
  (<:as-html (pgn-string window)) (<:br) (<:br)
  (<ucw:a :action (ok window) "Back"))



More information about the bese-devel mailing list