in reply to Re: Getting all values from a CGI list box
in thread Getting all values from a CGI list box

"That can be done for example with a little bit of Javascript and some hidden form component."

Yeah, this is what I was trying to do, but can't seem to stuff a J/S filled array into a param.

Thanks for the info, though.

  • Comment on Re^2: Getting all values from a CGI list box

Replies are listed 'Best First'.
Re^3: Getting all values from a CGI list box
by ikegami (Patriarch) on Jan 02, 2007 at 18:54 UTC
    You'll need to serialize them (join them together into one string) in JS, then deserialize them (seperate them back into a list) in Perl.

      He might as well use perl to create his hidden form field value using the same array as in the scrolling_list call.

      For (de)serializing the stuff he can make good use of the code you++ provide on your scratchpad. ;-)

        Thanks, but URI escaping is accessible in this case and works just fine. No need to introduce a new protocol.
      I was afraid you were going to say that :^\

      With this data, my delimiter is going to be rediculous.

      Thanks.

        Having to pick a delimiter that won't occur in your data is bad. Instead, escape the data such any instance of you your delimiter is removed or distinguishable from an actual delimiter.

        In this case, it's easy to remove commas by URI escaping the data before joining the fields.

        At the client, (My syntax might be off)

        list_items.value = list_items .map(function (v) { return encodeURIComponent(v) }) .join(',');

        At the server,

        use URI::Escape qw( uri_unescape ); my @list_items = map { uri_unescape($_) } split(/,/, $cgi->param('list_items'));