By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,460 Members | 1,138 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,460 IT Pros & Developers. It's quick & easy.

how to retrieve data with quotes from database without any quotes in it in JavaScript

P: 1
Expand|Select|Wrap|Line Numbers
  1. var str = document.forms[0].elements['requestBean.text'].value;  
  2.                   // alert("Str length"+str.length);
  3.                   var str1 =str.replace(/['"]/g,'');;
  4.                   // alert("Str1 length "+str1.length);
  5.                   document.forms[0].elements['requestBean.text'].value =  str1;
  6.                   // alert("b4 submit "+document.forms[0].elements['requestBean.text'].value);
  7.  
  8.                document.forms[0].elements['requestBean.actionStatus'].value ="insertWhiteBoard";
  9.                document.forms[0].action="
  10.                  // alert(document.forms[0].action);
  11.                document.forms[0].submit();
  12.              }
Nov 30 '12 #1
Share this Question
Share on Google+
2 Replies


Dormilich
Expert Mod 5K+
P: 8,639
since JavaScript does not query the DB directly, remove the quotes on the server level where the DB interaction takes place.
Nov 30 '12 #2

100+
P: 185
You may use escape and unescape java script functions.
Jan 5 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.