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

Collapse
Posted by Tom Jackson on

Don, having used the form builder procs, I can state that ad_form appears to greatly simplify the situation.

When I said that ad_form supports and encourages mixing markup with tcl code, I was referring to the -html arguments to both ad_form and each individual form element. The example given in the documentation also uses these arguments. It seems pretty clear to me that the form builder generates html, and the use is encouraged by every example I have seen. Maybe instead of showing examples of default behavior, some examples of using the vars generated with ad_form in an adp page would help explain the situation.

The default behavior makes it more difficult to read and edit the tcl file, or understand what the adp will generate without reading the tcl file. The example, or examples, should other important details as well:

  • If you have a select list, how can you generate this by a db select so that you don't hard code the option values in the tcl file? What about the display name for the options?
  • How can you select from the db, or include on the adp page the "you screwed up" hint for the confirm form? If I change the hint, I want to do it maybe in one place in the db, or be able to include it in the adp file so future maintainers don't have to edit the tcl file.
  • How can I change the -html values other than editing the tcl file? If I can change something in the db and then select that for use in ad_form that would be great.

    The bottom line is I would like to avoid editing the tcl file to change the look. Once you hard code what the form html is going to be, you replace editing 100 adp templates with editing a 100 tcl files.

    Unfortunately when ad_form is used in core packages, every developer is forced to know how it works. Future maintainers are going to have to know it well. Explaining how ad_form works in a forum post isn't documentation, it is an indication of a lack of documentation. The fact that Don, Dave and a few other people can explain it and use it doesn't mean that it is documented.

    Dave, I did a checkout of simple-survey, but didn't find any use of ad_form. How can I obtain this package with the changes you are talking about?

    Finally, I've said it before wrt ad_form, it must be useful, otherwise the folks who are using it wouldn't be. Maybe I just need to fastforward to Thursday, drink a beer and mellow out.