Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??

Thanks for the feedback and ideas, but I couldn't get any of these ideas to work for me.  They do work if all I wanted to do is sort a hash by values.  But trying to drop such a sorted hash into the CGI directive, scrolling_list() seems to be too much for the module--it either fails or it still sorts according to key or it doesn't sort at all.

Anyway, I've worked around it. The content of my values already read, "$client_name - $clientid" with the key reading, "$clientid."  So I changed my scrolling_list to read simply like this:

print $q->scrolling_list(-name=>'acct_num', -values=> [sort values %clients] );

This gives me the alphabetical sort based on the client names (e.g., values) that I need.  It does make the HTML option select value the same as the label (e.g., client name - client id)--granted, very messy.  But I put the following line in the next CGI script that parses out the data entered in the first script:

$acct_num = (split/ \- /, $acct_num)[-1];

This has solved my immediate problem.  However, if anyone can contribute more comments to my original question, I would glad to have them for my education and for those who might read this posting in the future.  Thanks.

In reply to Re: More Sorted Business with Hashes by Spenser
in thread More Sorted Business with Hashes by Spenser

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.