Forum OpenACS Q&A: want a template::widget::checkbox_in_table proc!!!

Hi I am looking for an easier way to accomplish this (basically a checkbox or radio multi in a table):
<formtemplate id="edit_ad">
  <table>
  <formgroup id=match_orientation cols=3>
  <if @formgroup.col@ eq 1>
    <!-- Begin row, i.e. <tr> --> 
    <tr>                 
  </if>
  <!-- Cell layout, i.e. <td>...</td> -->
  <td>                    
    <!-- Cells may be unoccupied at the end. -->
    <if @formgroup.rownum@ le @formgroup:rowcount@>
         @formgroup.widget@ @formgroup.label@
    </if>
    <else>
      <!-- Placeholder to retain cell formatting -->
    </else>
  </td>  
  <if @formgroup.col@ eq "n">
    <!-- End row, i.e. </tr> -->
    </tr>
  </if>
  </formgroup>
  </table><br>
  </formtemplate> 
It would be great if such a widget already existed in the template::widget namespace. Then I could simply use formtemplate tag in my adp. I don't want to have to do formgroup tags and formwidget tags for all my elements in my form. It's a big form:(

Has anyone a widget like this in their private toolbox they'd consider loaning me?!!!

thanks;)

Collapse
Posted by tammy m on
Actually, I accomplished this by creating my own template for my form. I replaced the bit with table following <if @elements.widget@ in radio checkbox> in the /packages/acs-templating/resources/forms/standard.adp with the following table in my new template.
        <if @elements.widget@ in radio checkbox>
            <if @elements.label@ nil><td colspan=2>></if>
            <else><td></else>
            <noparse>
            
            <table cellpadding=4 cellspacing=0 border=0>
              <formgroup id=@elements.id@ cols=3>
                <if \@formgroup.col@ eq 1>
                  <!-- Begin row, i.e. <tr> -->                  <tr>
                </if>
                <!-- Cell layout, i.e. <td>...</td> -->
                <td>
                  <!-- Cells may be unoccupied at the end. -->                  <if \@formgroup.rownum@ le \@formgroup:rowcount@>
                       \@formgroup.widget@ \@formgroup.label@                  </if>
                  <else>
                    <!-- Placeholder to retain cell formatting -->
                  </else>
                </td>
                <if \@formgroup.col@ eq "n">
                  <!-- End row, i.e. </tr> -->
                  </tr>
                </if>
                </formgroup>
                </table><br>        
              <formerror id=@elements.id@><br>

This makes much prettier radio and checkboxes in my forms:)