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 "( )" as well but it seems all spaces are removed and the   is actually printed as part of the checkbox title
foreach $bit (@the_list) {
$the_labels{$bit} = $bit . "  label1 " . " 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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.