I know that it will be something simple that I somehow missed, but here it is:
I have a ColdFusion application in which a user can enter text on multiple screens. I have a javascript function that checks the entered text for what is stored in the database, and a confirmation window pops up asking if they want to save or discard the changes.
If the user-entered text contains quotation marks (single or double), javascript dies completely. I need to avoid quotes while still being able to check for content matching.
I tried the escape () and replace () functions (separately and together), but nothing works.
Javascript example:
function change_question(){ var feedback = document.getElementById('feedback').value; //this is what the user has entered on the page var stored_feedback = "#trim(StoredFeedback)#"; //this is what is stored in the database; retrieved via ColdFusion if (feedback != stored_feedback) { if (confirm('You have unsaved data on the page. Do you wish to discard your changes?')) { //go to next page } } else { //go to next page } }
Thanks.
shimmoril
source share