Thanks! When I tried it before, it put it at the bottom of the list. I
think this one is a winner!

On Sep 5, 2:08 pm, Iceberg <iceb...@21cn.com> wrote:
> I did see your message. I just thought my previous patch already take
> that into consideration. But since you insist, your wish is
> granted. :-)
>
> Index: sqlhtml.py
> ===================================================================
> --- sqlhtml.py  (revision 1196)
> +++ sqlhtml.py  (working copy)
> @@ -201,7 +201,8 @@
>                  raise SyntaxError, 'widget cannot determine options
> of %s' \
>                      % field
>          opts += [OPTION(v, _value=k) for (k, v) in options]
> -
> +        if value not in [k for k,v in options]:
> +            opts.insert(0,OPTION(value,_value=value))
>          return SELECT(*opts, **attr)
>
> On Sep6, 2:49am, "mr.freeze" <nat...@freezable.com> wrote:
>
> > Iceberg, did you see my previous message about inserting the option at
> > the *top* of the list?:
>
> > > On Sep6, 2:32am, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > Iceberg, do you want to submit a patch? Massimo, do you have any
> > > > issues with this change? I verified that it works when multiple=True
> > > > as well.
>
> > > > > > On Sep5, 11:51pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > > > > Perhaps a better solution is checking if the value for 'default'
> > > > > > > argument is *not* in the set and then appending it to the set but 
> > > > > > > not
> > > > > > > allowing it to pass validation if selected.  What do you think?
>
> > > > > > You are a genius! This solution reaches the original goal without 
> > > > > > any
> > > > > > known side effect.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to