Forum OpenACS Q&A: ad_form, elements horizontal

Posted by Åsmund Realfsen on

It is possible to get ad_form to display elements horizontal instead of vertical ?

Posted by Matthew Dodwell on
Hi Asmund,

Depends what you're trying to do. I've just being working on coding custom widgets to group related fields horizonally. I based my work on the currency widget (acs-templating/tcl/currency-procs.tcl) to get a widget with an entry box and drop down entry box using the on_refresh methods. - If this is what you're trying to do I can let you have my code as an example.

Just to display a standard ad_form arranged horizontally would require custom coding of the ad_form method.


Posted by Claudio Pasolini on
If you don't put anything between the <formtemplate> and the </formtemplate> tags, the form is rendered as specified by the style attribute of the <formtemplate> tag.

By default the standard style is used, but you can provide a customized style or adjust one of the styles provided (you will find them at /yourservice/packages/acs-templating/resources/forms

To customize the rendering without affecting the styles you could use the template::form::template API (for example putting the line
ns_log notice "[template::form:template myform]"somwhere in your tcl and then cut and paste the resulting output between the <formtemplate> and the </formtemplate> tags.

You are then free to customize the rendering of the form as you please.