> I finally started making forms in my app this week. I found Mako more
> convenient than any of the form libraries. I use a call-with-content
> to format an input control with its title, hint, and error message.
> Then htmlfill to set both the initial values and the error messages.
This is more-or-less what I always suggest to people. I think this is the
right way to do forms.
> ToscaWidgets has too many dependencies; it almost doubles the size of
> Pylons. Plus I understand the TW team wants to get rid of a couple of
> those dependencies, which Pylons has already jettisoned. lxml is
> required for TW's Javascript features.
I wish lxml was a cleaner install, but it isn't, so I quite understand the
reluctance to introduce a requirement on it. Incidentally lxml.html also
does also do what htmlfill does, and a bit cleaner IMHO.
The Javascript thing could be done without lxml, of course, just not as
compactly.
> Most of the HTML webhelpers were so trivial I didn't see much
> advantage over writing the HTML by hand. options_for_select was the
> only one I ended up using. Using static HTML has the advantage that
> my colleague can preview the template in a browser and adjust the
> layout & style.
>
> So I'm almost wondering if we should drop a lot of the HTML helpers
> rather than upgrade them. On the other hand,
> I guess basic tag functions are useful when you're generating the
> attributes dynamically.
IMHO one helper is enough. Some tag builder is nice, like
html.input(type="text", name="bar"). Ideally it handles None
intelligently (removing any attribute with a value of None). But not a
whole lot else. Having a bunch of helpers when this one normal form can
cover everything seems quite unnecessary. Select boxes might be the
exception.
Not to preclude any other work, but incidentally I've started playing
around with a form generation library, which I plan to take the form of a
tutorial instead of supported code. I haven't figured out exactly what it
will look like, except that the HTML will be front-and-center. I think I
might need some code to manipulate input field names, kind of like
htmlfill except like add_name_prefix(form, prefix), e.g.,
add_name_prefix("address.", address_html), which would let you aggregate
HTML form fragments.
For TW-style widgets I think the Javascript requirements stuff would be
handy as well, but I'll probably just present forms without Javascript in
the tutorial.
Ian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-devel" 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/pylons-devel?hl=en
-~----------~----~----~----~------~----~------~--~---