I have a javascript function working in Cold Fusion to remove character returns and replace them with <br>.
I have tried to adapt this to remove a comma from a text field before updating (to stop interfering with comma separated list) but it does nothing.
I have tried instead of Chr(44) entering a comma and still nothing. If I use a letter or other ascii it works fine, it just seems to be the comma!
I have tried to adapt this to remove a comma from a text field before updating (to stop interfering with comma separated list) but it does nothing.
I have tried instead of Chr(44) entering a comma and still nothing. If I use a letter or other ascii it works fine, it just seems to be the comma!
Code:
<script language="JavaScript">
<CFOUTPUT>
function removeCR(checkString)
{
newString = ""; // REVISED/CORRECTED STRING
count = 0; // COUNTER FOR LOOPING THROUGH STRING
// LOOP THROUGH STRING CHARACTER BY CHARACTER
for (i = 0; i < checkString.length; i++) {
ch = checkString.substring(i, i+1);
if ((ch >= "#Chr(44)#") || (ch = "#Chr(32)#")){
newString += ch;
}
}
return newString;
}
</CFOUTPUT>
</script>