I want to use a combo box in my template. I can use the standard html
approach however I would like
to use the pylons helper functions to accomplish this.
In my controller,I have the following:
c.credcardtypes=[("visa","visa")]
the template has:
${h.select("fieldnm","initvalue",c.credcardtypes)}
I dont know how to add multiple values to the combo list?
Much appreciated,
Garyc
Ok I think I figured it out:
class creditcardtype(BaseController):
def __init__(self,name,value,parent=None):
self.name=name
self.value=value
def registration(self):
self.cclist.append(creditcardtype("visa","visa"))
self.cclist.append(creditcardtype
("americanexpress","americanexpress"))
c.creditcardtypes=[(ct.name,ct.value) for ct in self.cclist]
That basically does what I want to do, however is there a better way
than this?
Much appreciated,
Garyc
Why not this way:
c.creditcardtypes=[("visa","visa"), ("americanexpress","americanexpress")]
Also, why does creaditcardtype derive from BaseController?
--
Paweł Stradomski
On Jan 3, 7:10 pm, Paweł Stradomski <pstradom...@gmail.com> wrote: