Forum OpenACS Q&A: Response to javascript, ns_urlencode, and IE

Collapse
Posted by Jonathan Ellis on
if I do that then I have to worry about escaping backslashes and other characters too. this is what I used to do but it's very fragile. urlencode takes care of all these quite simply so I'd really prefer to use that.

What I ended up doing is using a JS hash to hold the urlencoded strings. Apparently IE only tries to be helpful in hrefs so this sidesteps it:

set m_name_js "names = new Object;"
foreach m_id $l {
   append m_name_js "names.m$m_id = '[ns_urlencode $name]';"
}
then I pass the (numeric) id to my function and it looks up the appropriate name.