[Bese-devel] checkboxes

Julian Stecklina der_julian at web.de
Thu Mar 31 00:50:10 UTC 2005


Hello,

I have made a component to select among a list of items:

;; Range select

(defcomponent pic-range-select ()
  ((items :initarg :items :initform nil
	  :reader items)
   (hash  :initform (make-hash-table :test #'eq)
	  :reader hash)))

(defmethod render-on ((res response) (range pic-range-select))
  (<ucw:form
   (<:table
    (loop
       for item in (items range)
       do (<:tr
	   (<:td
	    (render-range-select-item range item))
	   (<:td
	    (<ucw:input :type "checkbox"
			:accessor (gethash item (hash range)))))))
   (<ucw:input :type "submit" :action (range-select range))))

(defmethod render-range-select-item ((range pic-range-select) item)
  (<:as-html item))

(defaction range-select ((range pic-range-select))
  (answer (let ((values nil))
	    (maphash (lambda (key val)
		       (when val
			 (push key values)))
		     (hash range))
	    values)))

The problem is that it always returns a list containing the last element
of items. Am I missing something?

Regards,
-- 
Julian Stecklina

-- Common Lisp can do what C, C++, Java, PASCAL, PHP, Perl, (you --
-- name it) can do. Here's how:                                  --
--                                                               --
-- http://www.amazon.com/exec/obidos/ASIN/1590592395             --



More information about the bese-devel mailing list