in reply to Re: Formatting labels of checkbox groups
in thread Formatting labels of checkbox groups

Hey Zed,

I've tried to generate the checkboxes one at a time like in your second example.

CGI::checkbox(-name => 'the_group', -value => $value, -label =>'')

Now what i require is something similar to...

$some_spaces = " " #here are 4 spaces. $my_label = $title . $some_spaces . $description . $somespaces . $more +text # the variables above just represent some basic information CGI::checkbox(-name => 'the_group', -value => $value, -label =>$my_lab +el)
now what i'd expect from the web page is a checkbox with a label that has each part split by 4 spaces.
Unfortunately the html is being smart and removing unnecessary white space, so what i end up with is each variable only being seperated by a single space, ideally what im looking for is a way to get around this.
any more ideas would be appreciated


Replies are listed 'Best First'.
Re^3: Formatting labels of checkbox groups
by Zed_Lopez (Chaplain) on Aug 16, 2004 at 06:31 UTC

    Sorry, I thought the crux of the matter was doing complex, dynamic labelling that was inconvenient with checkbox_group.

    Like the first respondent said, you could use ' ' x 4 instead of 4 spaces. If what you really want is columns, use HTML tables or CSS.

    Or use -label => '' and put in your own label after the checkbox by hand with CGI::pre("$title    $description    $moretext")

      Hey again Zed,

      well actually the problem started with dynamic labelling of anywhere between 10 - 2000 checkboxes, which obviously meant creating the one checkbox_group. Unfortunately though im building a web-based interface to some webmin modules. (Webmin is a web base interface to Unix/Linux written in perl)
      because of this CSS is out of the question.
      Currently the checkbox structure is already in it's own table with columns, but that's where i keep running into blocks. i also require the checkbox labels to also be in columns.
      I was hoping to also achieve this without having to create the possible 2000 boxes individually on the fly.

      i've already tried    but that didnt work, instead all it does is interpret the &nbsp and print it with part of the label.
      I've also tried

      CGI::pre("$title $description $moretext")
      but that seems to embed the  <PRE>tags into the actual desription rather than interpreting them as the html that they're meant to be.

        I'm not suggesting putting &nbsp; or CGI::pre within a -label parameter. I was suggesting outputting them after the checkbox call (and you would have to call checkbox individually for each desired checkbox.)

        If you want to use checkbox_group, you'll need your own, like tye suggested. You could modify your (which will probably bite you in the long run), create a new package that subclasses it, or copy CGI's checkbox_group code into your own stuff and modify it there.