There is a rule. helpers attributes that start with _ are converted
blindly into html tag attributes
DIV(_class="hello") : <div class="hello"></div>
INPUT(_value="hello") : <input value="hello"/>
helpers attributes that start without underscore (only value,
requires) have special meaning. "value" sets the value of the variable
associate to an INPUT field.
We cannot change names for backward compatibility and it is not
obvious to me that using names that do not follow a rule are easier to
remember.
Anyway, I suggest you use
from gluon.sqlhtml import *
form=form_factory(SQLField('varname',default='yourdefault'))
which makes life easier.
Massimo
On 20 Apr, 22:20, waTR <[email protected]> wrote:
> I was just wondering if there is any reason for the difference between
> some HTML helpers used by web2py. Specifically, there is a value=""
> and a _value="" argument used by some HTML helpers. I feel this very
> confusing, and while I understand the use, I very-much feel it should
> be changed to something else (i.e. default_value="" or _default="")
>
> I.e.
>
> SELECT() uses value="" and _value="". I really feel value="" needs to
> be changed to something like selected_value="". This is mainly because
> it makes for a false impression to use _value when in reality you are
> generating a selected="yes" line. For the SELECT() function this is
> especially confusing.
>
> Just my 2 cents.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---