Forum OpenACS Development: Response to ad_form for new and edit requests

Collapse
Posted by Don Baccus on
The trick Jon's using in acs-person/www/add-edit.tcl is to define the key as an optional variable in ad_page_contract, as well as the key for ad_form.  Then you can check for its existence to tell whether or not you're building an edit form or new data form before calling ad_form.

I've thought about adding request blocks similar to the submit blocks but I'm concerned about ad_form becoming overly complex and therefore hard to learn to use.  It's quite complex already.

Also ... for the example you're describing - and Jon's example, too - the action (set a page title, set a context bar) doesn't logically belong with the form building code.  ad_form is building a form within a page, it makes sense that you'd have page-building code generating template information that's not part of the form outside the ad_form call.

But ... I'm open to creative ideas as to how it can be extended to make it easier to use!