Forum OpenACS Q&A: radio buttons on different sections with ad_form

Hello,

I am trying to have a radio button whose options are in different "sections" in the page. To make it clear, I have a radio button that has 5 different options and I want two to be grouped together and the other three together, something like:

Section 1
( ) Option 1     ( ) Option 2

Section 2
( ) Option 3 ( ) Option 4 ( ) Option 5
I haven't found out a way to do this with the form builder as the widgets for the radio buttons are in a <formgroup>.

Any suggestions on how to deal with this? At the moment I am thinking on having two different radio buttons and then do the checks with javascript if all fails but that's really not something nice...

Thanks in advance.

Collapse
Posted by Dave Bauer on
The technique currently is to have the entire formtemplate in your ADP file.

So instead of

<formtemplate id="myform"></formtemplate> you'd have to put in all the <formwidget> etc calls inside the formtemplate tags.

Collapse
Posted by Andrei Popov on

It maybe a good idea to refactor current templates to be more XHTML-friendly (at least as friendly as 'Transitional' goes). For instance — add <fieldset> instead of current table-based element grouping.

Collapse
Posted by Bruno Mattarollo on

Thanks

It also happens that I didn't read carefully the documentation about formgroup, in particular the fact that if you use cols as a parameter in the tag, it behaves like the grid tag. So I used that and some custom stuff to make sure I display the section name from the template itself but I used a template from acs-templating/resources/forms/ instead so I can re-use it for several forms.

Thanks again

Collapse
Posted by Hamilton Chua on
I tried to use the cols attribute on a formgroups tag in the standard.adp template in acs-templating/resources/forms but I get an error @formgroup.widget@ not found or something like that. If I remove that piece, I get another one complaining that it can't find @formgroup.option@.

It seems it's not seeing the formgroup variables.

Any ideas ?