in reply to Re^4: Getting all values from a CGI list box
in thread Getting all values from a CGI list box
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'));
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Getting all values from a CGI list box
by pKai (Priest) on Jan 02, 2007 at 21:56 UTC | |
by ikegami (Patriarch) on Jan 02, 2007 at 22:31 UTC | |
by pKai (Priest) on Jan 02, 2007 at 23:12 UTC |