durusmail: quixote-users: Generalizing form/widget API a bit
Generalizing form/widget API a bit
2003-11-25
2003-11-25
2003-11-25
2003-11-25
2003-11-25
2003-11-26
2003-11-26
2003-11-26
2003-11-26
2003-11-26
2003-11-26
2003-11-26
2003-11-26
2003-11-26
2003-11-26
2003-11-26
2003-11-29
2003-11-30
2003-11-26
2003-11-26
2003-11-26
Patch: add html_attrs keyword arg to widget classes
2003-11-30
Patch: add html_attrs keyword arg to widget classes
2003-12-01
Patch: add html_attrs keyword arg to widget classes
2003-12-01
Patch: add html_attrs keyword arg to widget classes
2003-12-01
2003-12-02
2003-12-03
2003-12-02
Patch: add html_attrs keyword arg to widget classes
2003-12-01
Patch: add html_attrs keyword arg to widget classes
2003-12-01
Generalizing form/widget API a bit
Michael Watkins
2003-11-26
On Wed, 2003-11-26 at 13:44, Martin Maney wrote:
> I suppose it looks more attractive to those who are using a lot of
> size='12px' and color='green' and so forth, but I'm tempted to suggest
> they get hold of a copy of Zeldman's "Designing with Web Standards".

Passing various attributes to form widgets need not go against good web
style, quite the contrary, and I'm sure you did not mean to suggest
that.

While sometimes I do want to pass style info (you could highlight a
field with an error condition for example), there are other needs that
widget level attributes could address.

Examples of things a with-it web designer trying to deal with web
accessibility, rather than formatting might want to pass:

        accesskey
        tabindex
        disabled

        {'accesskey':'e', 'tabindex':'5'}

Not to mention stuff like onchange/onclick etc event handlers.

Not meaning to start any style wars, but I was thinking there are
reasons why  tieing more HTML functionality to the form widgets could be
useful. Should we fear that? It is an HTML forms package, after all.

Anyway, it would also be handy if:

        - fieldset and legend were supported directly in Form.
        Its easy enough to subclass, but perhaps should be there in the base
class anyway.
        
A legend for your form various form widgets
Here's an example of what that produces, with just a tiny bit of styling to thicken the border and turn it green: http://www.mikewatkins.net/images/misc/formexample.gif - tabindex could be set automatically, in order of widgets being added, starting at 1 or whatever might be passed as an initial value when the Form instance is created. - Widget labels perhaps should automatically underline the first occurance of the character value "accesskey" within the labels, if found. Could probably come up with other examples, but you get the picture. Anyway, I think doing nothing more than passing a dict or some other agreed upon method of informating Widget.render() of other html attributes would go a long way... -- Mike Watkins mw@mikewatkins.net Vail's Second Axiom: The amount of work to be done increases in proportion to the amount of work already completed.
reply