Click to See Complete Forum and Search --> : Find and replace


lmf232s
09-23-2004, 10:55 AM
I have this 1,320 and its not seeting it as a number i guess when
i am doing the validation.

I guess i need to find the , and replace it with "" so i get
1320

This is some of the code.


sValue = replaceAll(sValue, ",", "")
//check to make sure its a number, if it is go to the else if not drop in and error out
if (isNaN(parseFloat(sValue))==true){
//if the text is blank then dont error out
if (sValue >= 0){
}
else{
//the text was not blank and was not a number error out.
if (Temp.match("txtWGF")){
alert("You Have Entered An Invalid Forcast Number");
}
if (Temp.match("txtSafeStk")){
alert("You Have Entered An Invalid Safety Stock Number");
}
oForm.elements[i].focus();
oForm.elements[i].select();
bValid = false
break;
}
}else{


and if you have a more effieient way to write this statment let me know. Not that good with javascript.

artemis
09-23-2004, 12:31 PM
would this be any good?

n="3,120";
n=n.replace(',','');
document.write(n);

lmf232s
09-23-2004, 12:37 PM
that works,
Thanks.