Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 22:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found