#902: [PATCH] All input widgets should have a "field_id" param to allow
overriding the DOM element's id
---------------------+------------------------------------------------------
Reporter: alberto | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 1.0b1
Component: Widgets | Version: 0.9a5
Severity: major | Resolution:
Keywords: |
---------------------+------------------------------------------------------
Comment (by michele):
Quick since I'm going offline... :-(
The id is bound to the name of the widget so you can already override it
in an easy way and in *one* way, the name is what makes the distinction
between two widgets so I can't see why we need two different way (name and
id) to distinguish them when by using different names you get different
ids that you're sure will not cause any name collision.
Also, I don't think we should encourage developers to shoot on their foots
with id collisions, if you have and id collision you can't distinguish
widgets so the whole thing is useless.
Finally, adding field_id to the Widget base class makes no sense since a
Widget base class should not make such an assumption as field_id (a field
is a form related concept), a better name in this case will be "widget_id"
or simply "id" (if possible (name collision with python? I haven't tested
it) id makes even more sense for a field instead of field_id).
But in the end why we shouldn't use the name as the widget id? apart from
form related widget the name HTML attribute has no use so you should
probably use it as the id, this means you already have the feature you
want without any modification.
{{{
class MyWidget(Widget):
template = """<div id="$name">...</div>"""
}}}
Anyway if you want such a thing please consider using "id" or "widget_id"
but not "field_id", in this case using "id" everywhere and deprecating
"field_id" will be the best thing to do IMHO. ;)
--
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/902>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Tickets" 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/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---