Forum OpenACS Development: Re: ad_form all over the place?

Collapse
Posted by Don Baccus on
As Dave makes clear, ad_form is just a wrapper around the ATS form builder, one that manages state for you and in general leads to simpler and easier-to-read code than direct use of the form builder.

It makes it very easy to write self-submit forms and to combine new content/edit content forms.  The first point's important because errors in forms (rather than "you messed up, hit 'back'") is user-friendly.  The second is important because you only have to maintain one block of form generation code, which guarantees consistency between "new" and "edit" data forms.

So the question is: do you want to be able to consistently modify the look and feel of forms throughout the system by changing a small set of shared templates, or would you rather change the look and feel of all forms on a site the ACS 3 way, by tediously editing hand-generated HTML on a large set of pages?

I vote for using the ATS and ad_form so I can change the look and feel by modifying a small set of templates.

And why would one only want to be able to change the look and feel of admin screens simply?  I'd say just the opposite - admin screens can be plain, ugly and hard to customize but user input forms need to be morphable to a site-designers vision of a consistent look and feel for a given site.

As far as rewriting old code ... if the code uses the form builder directly, no, we haven't bothered. When I've touched existing code for other reasons I have at times flipped the code to use ad_form because it only takes a few minutes and doing things like complex validation checks is simpler in ad_form than when you use the form builder directly.