QF hierselect: quotes and javascript?
| From: | Ignatius Reilly | Date: | Mon, 24 Nov 2003 11:03:50 +0000 |
| Subject: | QF hierselect: quotes and javascript? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-9097@lists.php.net to get a copy of this message | ||
I do not know whether this is a bug or a feature.
Say I want to create a hierselect. One of the selects is passed a value pair
( "1" => "O'Reilly" )
The javascript will squeak because it fails to escape the quote:
media_categ_8[1] = new Array('29', 'O'Reilly'); // produces a js error
Of course I can not escape the string before passing the value to the select
element the quote because the "O'Reilly" string will appear as the content
node of an <option> tag:
<option value="1">O\'Reilly</option> will not do.
Tweaking the hierselect code is simple; I wonder, however, if I did not miss
something more important.
Thanks
Ignatius