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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • murali0721
    New Member
    • Nov 2012
    • 1

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

    Code:
    var str = document.forms[0].elements['requestBean.text'].value;  
      				// alert("Str length"+str.length);
      				var str1 =str.replace(/['"]/g,'');;
      				// alert("Str1 length "+str1.length);
      				document.forms[0].elements['requestBean.text'].value =  str1;
      				// alert("b4 submit "+document.forms[0].elements['requestBean.text'].value);
      				
    			   document.forms[0].elements['requestBean.actionStatus'].value ="insertWhiteBoard";
    	 		  document.forms[0].action="
    	 			// alert(document.forms[0].action);
    			   document.forms[0].submit();
    			 }
    Last edited by Dormilich; Nov 30 '12, 12:38 PM. Reason: Please use [CODE] [/CODE] tags when posting code.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    since JavaScript does not query the DB directly, remove the quotes on the server level where the DB interaction takes place.

    Comment

    • Anas Mosaad
      New Member
      • Jan 2013
      • 185

      #3
      You may use escape and unescape java script functions.

      Comment

      Working...