Hoy vuelvo a este tremendo tema sobre formularios AS2 SUPER COMPLETO Y SUPER COMPLEJO a buscar una nueva función:
En la parte para ingresa teléfono y característica telefónica he agregado dos campos, el de telefóno móvil y característica del móvil. Ahora lo que debo hacer, aparte de respetar las características de validación que ya tengo, es agregar que SI UNO DE LOS CAMPOS DE movil o telefóno esta completo ya es VALIDO, es decir que no necesariamente tiene que llenar los dos campos (entiendase de caracteritica telefónica, telefóno o característica del móvil y el número del móvil) sino que con que complete uno ya es válido. El código es el sigueinte:
Código :
//campo característica telefónica
else if ( !Boolean(telefono.text.length) )
{
error_str = "Por favor, ingerese la característica telefónica de su localidad.";//campo característica telefónica
}
else if ( telefono.text.substr(0,1) != "0" )
{
error_str = "Por favor, revise el campo de característica telefónica de su localidad.";//campo característica telefónica
}
else if ( Number(telefono.text) == 0 )
{
error_str = "Por favor, revise el campo de característica telefónica de su localidad.";//campo característica telefónica
}
else if ( telefono.text.length < 4 )
{
error_str = "Por favor, revise el campo de característica telefónica de su localidad.";//campo característica telefónica }
}
//campo telefono
else if ( !Boolean(telefono2.text.length) )
{
error_str = "Por favor, ingrese su teléfono.";//campo telefono
}
else if ( Number(telefono2.text) == 0 )
{
error_str = "Por favor, revise el campo de teléfono.";//campo telefono
}
else if ( telefono2.text.length < 5 )
{
error_str = "Por favor, revise el campo de teléfono.";//campo característica telefono
}
else if (telefono2.text.substr(0,1)=="0" || telefono2.text.substr(0,1)=="2" || telefono2.text.substr(0,1)=="3" ||telefono2.text.substr(0,1)=="5" || telefono2.text.substr(0,1)=="6" || telefono2.text.substr(0,1)=="7" || telefono2.text.substr(0,1)=="8" || telefono2.text.substr(0,1)=="9")
{ error_str = "Por favor, revise el campo de teléfono.";//campo telefono
}
//campo característica movil
else if ( !Boolean(movil.text.length) )
{
error_str = "Por favor, ingerese la característica telefónica de su movil.";//campo característica telefónica movil
}
else if ( movil.text.substr(0,1) != "0" )
{
error_str = "Por favor, revise el campo de característica telefónica de su movil.";//campo característica telefónica movil
}
else if ( Number(movil.text) == 0 )
{
error_str = "Por favor, revise el campo de característica telefónica de su movil.";//campo característica telefónica movil
}
else if ( movil.text.length < 4 )
{
error_str = "Por favor, revise el campo de característica telefónica de su movil.";//campo característica telefónica movil
}
//campo movil
else if ( !Boolean(movil2.text.length) )
{
error_str = "Por favor, ingrese su teléfono móvil.";//campo móvil
}
else if ( Number(movil2.text) == 0 )
{
error_str = "Por favor, revise el campo de teléfono móvil.";//campo móvil
}
else if ( movil2.text.length < 5 )
{
error_str = "Por favor, revise el campo de teléfono móvil.";//campo móvil
}
else if (movil2.text.substr(0,1)=="0" || movil2.text.substr(0,1)=="2" || movil2.text.substr(0,1)=="3" ||movil2.text.substr(0,1)=="5" || movil2.text.substr(0,1)=="6" || movil2.text.substr(0,1)=="7" || movil2.text.substr(0,1)=="8" || movil2.text.substr(0,1)=="9")
{ error_str = "Por favor, revise el campo de teléfono móvil.";//campo móvil
}
else if ( !Boolean(movil.text.length) )
{
error_str = "Por favor, ingerese la característica telefónica de su movíl.";//campo característica telefónica
}
else if ( movil.text.substr(0,1) != "0" )
{
error_str = "Por favor, revise el campo de característica telefónica de su móvil.";//campo característica telefónica
}
else if ( Number(movil.text) == 0 )
{
error_str = "Por favor, revise el campo de característica telefónica de su móvil.";//campo característica telefónica
}
else if ( movil.text.length < 4 )
{
error_str = "Por favor, revise el campo de característica telefónica de su móvil.";//campo característica telefónica }
}