[Bese-devel] Re: UCW submit action issues

Christian Haselbach chriss at muon.de
Tue May 2 19:22:47 UTC 2006


On Tue, May 02, 2006 at 06:19:39PM +0200, Marco Baringer wrote:
> Christian Haselbach <chriss at muon.de> writes:
> 
> > (defmethod render ((bac b-action-component))
> >   (<:h1 (<:as-html "Choose your action #" (counter bac)))
> >   (<:form (<ucw:submit :value "one" :action (call-viewer bac "one"))
> > 	  (<ucw:submit :value "two" :action (call-viewer bac "two"))))
> >
> > This does nothing (except bringing you back to the start).
> 
> if you change that to <ucw:form (not <:form) does it work?

No, all this does is to let the javascript debuger complain about
missing dojo. I guess it would work with javascript if dojo would be
loaded.

Just checked, yes it does. Defining the component to load dojo.js makes
the button action work.

With links it works just fine (without javascript):
(defmethod render ((bac b-action-component))
  (<:h1 (<:as-html "Choose your action #" (counter bac)))
  (<ucw:a :action (call-viewer bac "one") (<:as-html "one"))
  (<ucw:a :action (call-viewer bac "two") (<:as-html "two")))

I can solve the particular problem with links. It is just that I thought
buttons would work the same way.

Regards,
Christian

P.S.: The test program is not too long, so here it is, if someone wants
to see it:

(in-package :it.bese.ucw-user)

(defvar *b-action*
  (make-instance 'cookie-session-application :url-prefix "/baction/"))

(register-application *default-server* *b-action*)

(defentry-point "index.ucw" (:application *b-action*) ()
  (call 'b-action-component))

(defcomponent b-viewer (simple-window-component)
  ((name :accessor name :initarg :name)))

(defmethod render ((bv b-viewer))
  (<:p "Action: " (<:as-html (name bv)))
  (<ucw:a :action (ok bv) (<:as-html "ok")))

(defcomponent b-action-component (simple-window-component)
  ((counter :accessor counter :initform 0)))

(defaction call-viewer ((bac b-action-component) name)
  (incf (counter bac))
  (call 'b-viewer :name name))

;;; Using form action - works
(defmethod render ((bac b-action-component))
  (<:h1 (<:as-html "Choose your action #" (counter bac)))
  (let ((name "n/a"))
    (<ucw:form :action (call-viewer bac name)
	       (<ucw:submit :value "one" :accessor name)
	       (<ucw:submit :value "two" :accessor name))))

;;; Using button action - doesn't work w/o javascript
(defmethod render ((bac b-action-component))
  (<:h1 (<:as-html "Choose your action #" (counter bac)))
  (<ucw:form (<ucw:submit :value "one" :action (call-viewer bac "one"))
	     (<ucw:submit :value "two" :action (call-viewer bac "two"))))

;;; Using link action - works w/o javascript
(defmethod render ((bac b-action-component))
  (<:h1 (<:as-html "Choose your action #" (counter bac)))
  (<ucw:a :action (call-viewer bac "one") (<:as-html "one"))
  (<ucw:a :action (call-viewer bac "two") (<:as-html "two")))



More information about the bese-devel mailing list