Javascript errors with Special Characters in User entered field names
Posted: Sat Mar 08, 2008 4:34 am
Hi, I have justed encountered some javascript errors when I have used Page names containing single quotes (').
On checking the code I found that the the names were being drawn from the Database without being formatted for special characters.
My case in particular concerned using a single quote (') in a page name. When this name was then listed by the 'listcontent.php' the page name containing it's single quote was echoed inside a javascript call delimited itself, by single quotes ( so causing the error ).
I have just used a Php addslashes( ) call for the references in that file as that was all that was affecting myself, but I think there are more cases where user entered field names are used without being formatted for special characters.
Cheers
On checking the code I found that the the names were being drawn from the Database without being formatted for special characters.
My case in particular concerned using a single quote (') in a page name. When this name was then listed by the 'listcontent.php' the page name containing it's single quote was echoed inside a javascript call delimited itself, by single quotes ( so causing the error ).
I have just used a Php addslashes( ) call for the references in that file as that was all that was affecting myself, but I think there are more cases where user entered field names are used without being formatted for special characters.
Cheers