Button with URL Redirect - Single Quote Bug
trentFeb 10 2011 — edited Mar 3 2011Hi,
Not really sure if you are going to consider this a bug or not, but anywhoo, just ran into this issue.
The situation:
Page items on a page that are computed to some values
Button to redirect to another page, passing the values for page items
The issue:
For a button redirect, a javascript redirect is called, where the underlying URL is enclosed in single quotes. All fine, until your page item contains a single quote. As the function is expecting it to be the end of the function parameter, when it is not.
Demo:
http://apex.oracle.com/pls/apex/f?p=23834:500
Page 500
One item. P500_GYM_NAME
Default value - SQL Query: select 'Barry''s Fitness Shop' from dual
Button created as outlined above (to page 501).
Workaround:
When populating the values, escape the single quote. i.e. select replace(column_name, '''', '\''') column_name from table; or replace the sing quote using the URL (percent) encoding for a single quote (%27) as outlined here: http://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters (preferred method, imo) i.e. select replace(column_name, '''', '%27') column_name from table
..
So, would be good if support was added to encode a single quote character when constructing the URL.
That is all,
Thanks,
Trent