Javascript comparison is jumping right

0

I'm doing a registration page with 5 dropdowns on each line, but the user will not be required to fill all the dropdowns to complete the registration, for example, if the user fills the entire first line the second line will automatically be available so that if he wants it he can fill it too, but if he does not fill it, he can only send the contents of the first line to the bank, how can I check if the second line was also filled in < em> javascript ?

I tried this way:

if ($data.formInput.codEmpresaOTRS01.codigoEmpresa.length > 1 && $data.formInput.codEmpresaOTRS02.codigoEmpresa.length > 1){
    //Quando tanto a segunda linha quanto a primeira for preenchida
    x = 2;
} else if ($data.formInput.codEmpresaOTRS01.codigoEmpresa.length > 1){
   //Quando a primeira for preenchida apenas
   x = 1;
}
return x;

But he does not enter the second condition, what could be wrong in these comparisons?

    
asked by anonymous 13.06.2017 / 17:00

1 answer

0

I found out what I needed from this question , it is not that my variable was blank or null and it is that it had not been defined yet

    
13.06.2017 / 19:10