Forum OpenACS Q&A: Re: How to customize ad_form's HTML

Collapse
Posted by Bjoern Kiesbye on
Hello Matia,

you can place the widgets created with ad_form in your adp file, using the Tag <formwidget id="element_name"/> for single inputs like Textfields, and <formgroup id="element_name"></formgroup> (which is like a <multiple name="..">) for sets of inputs like Radio Buttons or Checkboxes. To display a widgets error message, if for example a data type check failed after the form was submitted, place <formerror id="element_name"></formerror> into the adp. All widget Tags must be nested within the <formtemplate id="your_form"></formtemplate> Tag of the form they belong to.

here is a little example:

<formtemplate id="order_form">
<tr>
<td>
<formwidget id="ac_email">
</td>
<td colspan="2" align="left">
<font color="red">
  <formerror id="ac_email"></formerror>
</font>
</td>
</tr>
<tr>
<td align="left" colspan="2">
MESSAGE KEY MISSING: 'accommodation.order_register_for_news_letter'
<formgroup id="ac_news_check">@formgroup.widget;noquote@</formgroup>
</td>
</tr>
</formtemplate>

I hope this helps,
Bjoern