Forum OpenACS Development: Moving HTML options for form elements to the ADP page

I have a vaugue idea to move the HTML formatting part of form elements to the ADP page without requiring the designer to specify the full form template inline in the ADP.

Right now when you use form builder or ad_form, the programmer can specify html attributes of the form element such as size or rows/cols in the tcl file when the element is created.

I am thinking that we want a way to be able to specify the html attributes for an element from the ADP file. Something like:

<formtemplate id="myform">
<formelement id="first_name" html="size 30">
<formelement id="middle_name" html="size 1">
<formelement id="last_name" html="size 30">
<formelement id="notes" html="rows 30 cols 80">
</formtemplate>

The formelement (or whatever, the tag name can be decided during implementation) would modify the form element definition before the form is rendered by the form template.

I think this might be useful for another option I wanted to add, the ability to specify grouping for form elements. So that in this example, a designer could specify that first_name, middle_name, last_name would all be grouped together. How they are "grouped" would be determined by the formtemplate used. Perhaps all in one table row, perhaps a box is drawn around it. That can be decided by the form style that is used.

I think this control might be best delagated to a designer.

Of course we can just specify each formwidget, I am not sure this is absolutely necessary, is there a better way to get this control but keep consistent form styling across a site?

Collapse
Posted by Tom Jackson on

Dave, this is a difficult problem. Any thought going into this will be helpful. It drives me crazy, as everyone probably knows, that html attributes are set in the tcl file. This is great for the developer, bad for the site maintainer, who is probably not interested in tcl code.

The plus is that general look and feel is centralized, but any move to get the details out of the tcl file would be an improvement.

One note on the format you are proposing: the html attribute is a tcl list. might it be possible to make it more atomic:

<formelement id="notes" rows="10" cols="80">

probably not, as you might need to replace all html attributes.

Overall, I think the problem is trying to replace html code with tcl code. You might get consistency, but it isn't easy to make changes in a few places.

dave,

i agree.  ideally, one would be able to take advantage of the centralization provided by ad_form, yet still have an option to override these (selected or all?) parameters in the .adp file.

i am new to openacs, and i've spent hours reading docs, but by putting together the developer, api docs, and stuff from jon griffin's, collaboraid, and jade's sites, i am starting to get my head around it.

as a side question: is there a way to specify a template (using the "style" argument to formtemplate) in an arbitrary location, not in acs-template/.../resources/?

--sasha

Collapse
Posted by Andrei Popov on
what is wrong with a default location?
so i wouldn't have to add my application-specific templates to an acs core package such as acs-template
Collapse
Posted by Jun Yamog on
Hi Alex,

Relative path work... ../../../foo/bar/here.adp

Normally I use this, so the package that I has a custom template has the adp of the form template.