[Lispweb] IMHO: popup-list

mdanish@andrew.cmu.edu mdanish at andrew.cmu.edu
Mon Feb 25 22:34:01 CST 2002

On Mon, Feb 25, 2002 at 10:12:14PM -0500, Erik Enge wrote:
> Hi, gang.
> I want to use the popup-list form-element IMHO offers.  In the
> documentation of the initarg items, it says:
>          assoc list, or function returning alist, of items appearing
>          in the list
> Fine.  So, I assume, then, that this should work:
>         (defun some-items ()
>          '(("1" . ("2" . ()))))
>         (resources
>          :type popup-list
>          :initargs (:items #'some-items))
> However, I get the error message:
>          FUNCTION is not of type LIST
> From the source (form-elements.lisp) I can tell that one does not even
> look to see if the slot items can contain a function and assumes it is
> a list (which explains the error).
> So, which is right, documentation or code?  Patches accepted?

Code, of course =)

I've always used a-lists of the form 

((:item-1 "Item 1") (:item-2 "Item 2") ...)

and never had trouble with it.  Your example a-list doesn't look like one,

As for patching, feel free to write your own version of it--copying code
as necessary.  Sometimes I simply redefine symbols in the IMHO package
when I find a bug, to have a fixed version quickly (and then I send a patch 
in); though there's no reason not to simply create another html-element
derived class in this case...

You probably only have to override the render-html method though.

; Matthew Danish <mdanish at andrew.cmu.edu>
; OpenPGP public key: C24B6010 on keyring.debian.org
; Signed or encrypted mail welcome.
; "There is no dark side of the moon really; matter of fact, it's all dark."

More information about the lispweb mailing list