diff --git a/js/functions.js b/js/functions.js index 3a5e42ff84..6dc19e72ea 100644 --- a/js/functions.js +++ b/js/functions.js @@ -387,13 +387,13 @@ function confirmQuery(theForm1, sqlQuery1) */ function checkSqlQuery(theForm) { + var sqlQuery; // get the textarea element containing the query if (codemirror_editor) { codemirror_editor.save(); - var sqlQuery = codemirror_editor.display.input; - sqlQuery.value = codemirror_editor.getValue(); + sqlQuery = codemirror_editor.getValue(); } else { - var sqlQuery = theForm.elements['sql_query']; + sqlQuery = theForm.elements.sql_query.value; } var isEmpty = 1; var space_re = new RegExp('\\s+'); @@ -411,7 +411,7 @@ function checkSqlQuery(theForm) return true; } // Checks for "DROP/DELETE/ALTER" statements - if (sqlQuery.value.replace(space_re, '') !== '') { + if (sqlQuery.replace(space_re, '') !== '') { if (confirmQuery(theForm, sqlQuery)) { return true; } else {