Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
The reason for the behavior you are seeing is that @predefined contains an array reference, rather than a plain value. Since you don't show how you defined @predefined, it is impossible to say where you went wrong. Suffice it to say that:
print $q->checkbox_group ( -name=>'predefined', -linebreak=>'true', -values=>@predefined, -defaults=>param('predefined'), );
is not the right way to pass values to a CGI method. @predefined will be flattened into the argument list. If @predefined contains a single value, you've lucked out and it will work okay. If @predefined contains an odd number of values, the first will be taken as the value for the -values key, and the rest will be taken as separate key/value pairs. Worst case, if @predefined contains an even number of values, all the remaining explicit key/value pairs will be shifted by one, so that the keys are used as values and vice versa.

In reply to Re: Re: Re: CGI.pm being funny? by chipmunk
in thread CGI.pm checkbox problem? by xtype

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 wandering the Monastery: (8)
As of 2024-04-19 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found