List Info

Thread: validate variables




validate variables
user name
2006-01-27 20:14:00
hi, i´m trying to asign a value to a variable but it seems
the
asignation does not work.

this is how i´m trying to do it. first take the value of a
text box an
asig it to a variable.(lets say the value of the text is
"sss") second
with the function isNumeric it determines if is numeric. if
it is not
then the variable is set to 0. at this time everything is
ok, but when
the line of code
"self.location='ingresa_activofijo.jsp?totaldefactura
= ' + total;" is executed the value of
"total" is send it as the value
of the text box.(sss) but the value would be "0".
i hope some one can help me. thank you in advance.
this is the code.

function isNumeric(val){
var resultado = false;
if(parseFloat(val,10)==(val*1)==true){
    if(val>800){
        resultado = 1;
    }
   }else{
        resultado = 0;
    }
return resultado;
}

function recuperaCampos(form){
    //se valida si el valor ingresado en totoal es numerico;
    var total =form.totaldefactura.value;
    if(isNumeric(total) == 0){
       total=0;
    }

self.location='ingresa_activofijo.jsp?totaldefactura = ' +
total;
}

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )