Background: Used raw DBI, CDBI, poked briefly at DBIC and now settled on Rose::DB::Object. All interfacing with web pages without any particular engine in the way/helping.

I've had a few web apps where I needed to present a list of options and show the selected option. Low volume sites, so all very easy to do with Template and something like:

<select name="whatever"> [% FOREACH option = whatever_options %] <option value="[% option.value %]" [% IF whatever == option.value %] selected="1" [% END %]> [% option.name %]</option> [% END %] </select>

Now I've hit a case where I have a <select multi="1"> dialog, so obviously the above Does Not Work.

In perl I have a list of objects representing the possible values (lets say categories), and another list representing the values selected for the current viewed object (lets say an article).

Some paths:

I *have* to generate a sane single list and pass to Template, anything else is wrong, but I'm unsure as to the best way to deal with this.


In reply to populating <select multi="1"> from ORM by abs0

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.