Morning fellow monks,

Im having troubles with displaying the formatting of the labels in a checkbox_group.

Basically what im trying to achieve is to create a horizontal list of check boxes, the labels for these checkboxes will vary and so must the formatting.

As shown in the code below...

... @the_list = ("1","2","3","4"); foreach $bit (@the_list) { $the_labels{$bit} = $bit . "label1" . "description"; } return (table({-border=>'0',-width=>'100%'}, start_form({-action=>'./somescript.cgi', -method=>'POST'}), TR,td,checkbox_group(-name=>'the_group',-values=>[@the_list],-linebrea +k=>'true',-labels=>\%the_labels), submit(-name=>'submit',-value=>'submit'), end_form() ) );

the problem i have is when i try to place any tabs or extra spaces in the description bits for $the_labels{$bit} they are removed when the routine is returned and displayed on the web page.
I've already tried placing extra spaces in the description and also placing "(&nbsp)" as well but it seems all spaces are removed and the &nbsp is actually printed as part of the checkbox title

foreach $bit (@the_list) { $the_labels{$bit} = $bit . "&nbsp&nbsplabel1 " . " description + "; }

Any help on what i might be doing wrong would be appreciated.

TIA Li

Updated for clarity. What i've got is some perl CGI scripts, one of these scripts functions is to display a vertical list of checkboxes that has a corresponding description next to it.
Now this description is actually derived from different places, so when i display the check_boxes, instead of the label being one complete string seperated by a single space, i actually require tabs and multiple spaces in the description.

The code i got for displaying a checkbox_group came from Perl monks CGI help pages. http://www.perlmonks.com/index.pl?node=perlman%3Alib%3ACGI%3A2

From this code it shows that a checkbox_group label is a pointer to an associative array relating the checkbox values to the user-visible labels.


In reply to Formatting labels of checkbox groups by lcanty

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.