On Mon, Jun 21, 2010 at 3:06 PM, Ben Bangert <[email protected]> wrote:


> I guess in that regard I somewhat envy the people that only create websites
> where every form cleanly maps to a single model. I just don't want to go
> through the effort of creating the model's, getting the whole thing ready,
> then finding out that they failed validation before saving them. That also
> confuses the issue of what the problem really was, did I not properly
> populate the model's, thus their validation failed? Or was the input from
> the user that I put into the model classes invalid and thus they failed
> validation?
>

Agreed 100%. What usually happens is that Rails has a built-in support for
simple cases which actually is more complicated than form == data row. And
for even more complex scenarios you end up with "fake models" that look&act
exactly like FormEncode forms. This isn't quite as elegant as Pylons design
but ends up being more practical, at least in my experience.


> It still baffles me why Rails (and I guess Django?) works this way, I can
> understand the simple use-case, but I so rarely see forms out there that
> actually satisfy this simple use-case except in simple demo apps for
> learning the framework.
>
> How come people don't get pissed that they can't validate their form data
> *before* they go to the effort of setting up the actual model instances and
> preparing to save them? Aren't they interested in whether the data they're
> dumping into them is valid before their model validator kicks it out?
>

I can think of 3 possible answers here: JS validators (jQuery has lots of
plugins), smaller AJAX-y forms and, for more complex monolithic forms - fake
models AKA form classes. I guess the reason I'm not a big fan of FormEncode
is because it defaults to the 3rd approach. And, again, I myself don't have
a better design/approach to suggest, without tying together html helpers and
models. Perhaps it wasn't the best idea coming from me today to even start
this discussion: I really have nothing constructive to contribute! ;-)

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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-discuss?hl=en.

Reply via email to