On Mar 3, 2:22 pm, Anthony <[email protected]> wrote:
> With SQLFORM (and .factory), the submit button is added automatically--you 
> can access the input widget via form.custom.submit.

Thanks. I was looking for it in widgets.

> Note, if your form is based on a db table, you should be able to use SQLFORM 
> itself (without .factory).

I've found it much easier to put a layer of proxy classes between the
DB and the controllers: they maintain complex invariants, they hide
ugly details (e.g. denormalizations to circumvent BigTable's lack of
JOIN), they offer a terse, no-nonsense API. So in addition to trying
and avoiding to mention HTML, my controllers don't mention db at all,
and I'd rather keep them that way.

> If you need to customize the form object, you can use server-side DOM 
> manipulation

If I understand correctly, this about getting a lot of things
generated automatically/magically, then fighting tooth and nail to
turn them in almost what you want? I can't help thinking of this as an
anti-pattern: when the magic doesn't work perfectly, it's often
simpler and more readable to write stuff yourself than to tweak magic
objects.

That's why I appreciate w2p's lack of an ORM layer:
- when the model and the DB map each other directly, automatic ORM
classes are only very expansive syntax sugar;
- when they don't, convincing the magic ORM classes to do as they're
told is often harder than writing them with plain code.

> You can also hide specific fields by setting their "writable" attribute to 
> False before creating the form in the controller.

Yes, the Field(...) data description language is awesome for data
validation!

> If you show some code, we might be able to help you simplify what you're 
> doing.

I will, as soon as I have something worth showing.

Reply via email to