On Sep5, 5:25pm, Fran <francisb...@googlemail.com> wrote:
> On Sep 5, 5:58 am, Iceberg <iceb...@21cn.com> wrote:
>
> > So my proposal is to adjust OptionsWidget to always show up with an
> > initial blank (when creating record), but not necessarily accepting
> > it. Just change line 198 of sqlhtml.py from:
> >   opts = []
> > to:
> >   if value:
> >     opts = []
> >   else: # To enforce an explicit choice when creating new record
> >     opts = [OPTION(_value='')]
>
> Nice idea, however, sometimes we do want the 1st option to be a
> default (since it's by far the most common option) & not make people
> select every time they're entering data....so this behaviour should be
> optional.
> Also, in order not to break backward-compatibility, this optional flag
> should default to off.
>
> F

Thanks for the comments anyway. I would like to give a scenario why
better make people select every time they're entering data. In a
bookshop selling Bible of different language, the clerk inputs book
orders all day long. 99% customers buy English edition of Bible, yet
some customers order Chinese edition or Italian edition etc. If our
order system has "English" as default value in the language field, my
one year observation told me the clerk would hardly remember to change
language field because he used to ignore that field at all for
previous 99 times. Think about Murphy's law: "Anything that can
possibly go wrong, does." It is a valuable lesson.

On the other hand, my proposal does not prevent you from explicitly
using default value at all. If you insist, you can still define
default value as always:
  Field('language',
    requires=IS_IN_SET(['English','Chinese','Italian']),
    default='Italian') # the default value need not even be the first
one
And you know what? In my patch, the initial blank will be
automatically hidden if you defines a default value. See the "if
value" clause of my patch.

After all, my proposal does not introduce any new syntax. Old apps can
benefit from it, and can easily bypass it if insist. What more can you
expect for? :-)

Sincerely,
Iceberg
--~--~---------~--~----~------------~-------~--~----~
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