Normally you pass OPTION helpers to the SELECT helper, and the OPTION helper 
can take a separate label and value: OPTION('label', _value='value'). As a 
shortcut, you can simply pass positional arguments to SELECT, and they will 
be treated as OPTIONs, but in that case it will use the argument as both the 
label and the value. You cannot simply pass a dictionary to SELECT, but you 
can do the following to achieve the same result:

options = {'Option 1': 'value 1', 'Option 2': 'value 2', etc.}
SELECT(*[OPTION(label, _value=options[label]) for label in options])

Anthony

On Tuesday, October 4, 2011 11:00:03 AM UTC-4, Matt wrote:
>
> Is it possible to pass in a dictionary to the SELECT helper, so that I
> can maintain a difference between representation and value of entries
> in a select element? I've tried to invoke this a few ways, but it
> seems its not "built-in." Unfortunately, I'm not familiar enough with
> gluon to supply a patch for this (yet!), can someone point me towards
> how to go about implementing this?
>
> Thanks,
> Matt
>

Reply via email to