Forms have the nasty habit to connect to everything from css styling to
your data model and application logic.
And most libraries do this by defining their own scheme:

- So the first thing you have to do is to write a wrapper and adapt the
form scheme to your application...
- Second: find the right places to customize the library, templates,
validators
- Third: if you need more than standard forms and still haven't quit -> You
end up with your own form library!
(and yes, I have one too)

Honestly, I think the easiest and fastest way is to use a validation and
serialization library like colander to handle
the server side processing and manually build the form in html/ templates.
The good thing is you can
simply toss in any jquery form/input field modules and build the form just
the way you need it.

Well, you will have the form fields listed twice, in the template and the
validation/serialization function, but
if you don't have too many forms this approach is still easier and faster
than handling a form library.

Arndt.


2012/12/11 Jonathan Vanasco <jvana...@gmail.com>

>
> On Thursday, December 6, 2012 4:35:57 AM UTC-5, malthe wrote:
>>
>> Hey Nicolas,
>>
>> I had a realization at some point that form libraries ultimately
>> aren't a joy to work with.
>>
>> Instead, I wrote `repoze.formapi` (see docs at http://docs.repoze.org/**
>> formapi/ <http://docs.repoze.org/formapi/>).
>>
>>
> I did something similar.
>
> I wrote pyramid_formencode_classic, which mimics the pylons formencode
> implementation but is much simpler
>
> https://github.com/jvanasco/pyramid_formencode_classic
>
> it doesn't do the form generation, but it will 'reprint' a form on failure.
>
> for the form generation, i just use mako functions
>
> in /-partials/forms.py  i have things like:
>
>     def form_textarea_a
>     def form_textfield_a
>
> ( 'a' denotes the style )
>
> then when rendering the forms, my templates look like (in psuedocode):
>
>    include /-partials/forms.py as t_forms
>    <form action="/path">
>       t_form.form_textfield_a('name',request.form.name)
>       t_form.form_textfield_a('email',request.form.email)
>    </form>
>
> i wanted the form styles to be mako defs, because it centralizes them but
> also moves them in the source tree to the templates section.  with a lot of
> the widget based form solutions, team members who shouldn't be touching
> backend stuff will need to touch backend stuff.
>
>
-- 
DV Electric / Arndt Droullier / Nive cms cms.nive.co

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to