Hi All,
I had created a text area in apex, where the users can enter upto 10,000 characters.
Now i had wrote a javascript function to capture the specail charcters and replace it wth the key word characters.
But these are unicdoes characters and here is the code which i had done from end.
Can any one help me out how we can check if specail characters exists and replace with proper key word characters dynamically.
Apart from this i should be able to handle the {a-z/A-Z/0-9/Space and so on}
--
function ReplaceSpecialCharaters(){
var theString = document.getElementById('P1_ENG_NOTES').value;
alert("The value for text area is:"+theString);
var unicodeString = '';
var temp ='';
for (var i=0; i < theString.length; i++) {
var theUnicode = theString.charCodeAt(i);
alert("theUnicode-->"+theUnicode);
// if theUnicode in (unicode values of a-z A-Z
if((theUnicode >= 97 && theUnicode <= 122) && (theUnicode >= 65 && theUnicode <= 90)){
temp=String.fromCharCode(theUnicode);
alert("Temp value is:"+temp);
while (theUnicode.length < 4 ) {
alert("hi in while");
theUnicode = '0' + theUnicode; }
}else{
alert("It is going inside the else loop");
unicodeString += String.fromCharCode(theString.charCodeAt(i));
alert("the Example process of unicodeString is"+unicodeString);
/*unicodeString += theString.charCodeAt(i);*/
}
theUnicode = '\\u' + theUnicode;
alert("The unicode value is "+theUnicode);
unicodeString += temp;
temp='';
}
alert("The value is "+unicodeString);
document.getElementById('P1_ENG_NOTES').value = unicodeString;
//doSubmit('Notes');
return true;
}
Thanks,
Anoo..