I submitted a couple of replies to the "SELECT" thread a couple of
days ago. I was having a similar problem and had derived a new class
which I called VSELECT which was an extension of the functionality of
SELECT.
The extension was that is one submitted a list of 2-tuples as the
*args to this VSELECT() class, it would split the values in each tuple
and assign element[0] to the Option value and element[1] to the Option
text. If a simple list of elements is used then it works the same as
the SELECT() class. You can mix the two types in the *args, even (but
why?). The code is in that other thread called 'SELECT' (I did not
start that thread...I just stole it!)
Massimo missed my point (bad description I guess) and interpreted that
I should be using a IS_IN_DB() call instead. He pretty much blew the
whole thing off, I was going to drop it until I figured out that it
did what I wanted better than anything else I could easily discover.
(My use of it was to create dependent menu selections...the contents
of menu-two would be loaded based on a selection from menu-one (by way
of an ajax call -- Massimo's ajax() function works just fine for it),
then the results of menu-two would load an INPUT element with a third
value pulled from the database and incremented.
[This is part of a front-end entry form for an automated software
build system that I am trying to translate into Python and
Web2.0 (hopefully will succeed using web2py sometime in the near
future) from Perl CGI which I wrote several years ago]
Anyway you can use this VSELECT class to create almost any select
element where the value is different from the description. It is bad
that I have a one-off class-name because that does not follow the HTML
pattern but it still has all the current functionality of the SELECT()
helper so it could be a replacement (Massimo doesn't what it though),
and also I hacked it into gluon.html, (my bad!). I have since taken
it out of the gluon library and put it into my application's modules
and just import it (I also have imported it across applications and it
still works there to).