Saludos a todos, aun no he logrado hacer que funcione .
1.- Como puedo validar 3 textbox? en donde al menos uno de ellos debe ser llenado.
'los datos que solicito son , telefono de casa, telefono de trabajo y celular'
2.- Si esto se cumple mover el cursor al textbox fdate
3.- En caso contrario mostrar mensaje "Estimado usuario por lo menos debe proporcionarnos un numero telefónico mover el cursor a homephone
esto es lo que llevo
--------------------------mi formulario--citasfrm.php-------------------------------------------------
<!-- Inicio enlace al archivo de validación -->
<script type="text/javascript" src="validar.js"></script>
<!-- Fin enlace al archivo de validación -->
<link rel="stylesheet" href="css/calendar-blue.css" media="screen">
<script type="text/javascript" src="js/calendar.js"> </script>
<script type="text/javascript" src="js/calendar-es.js"></script>
<script type="text/javascript" src="js/calendar-setup.js" ></script>
<script type="text/javascript">
window.onload = function() {
Calendar.setup({
inputField: "fecha",
ifFormat: "%d/%m/%Y",
button: "selector"
});
}
</script>
<style type="text/css">
<!--
body p {
font-family: Arial, Helvetica, sans-serif;
}
body p {
text-align: left;
}
body p {
text-align: left;
}
body p {
font-family: Arial, Helvetica, sans-serif;
}
body p {
text-align: left;
}
-->
</style>
</head>
<body>
<!-- Inicio Formulario de Contacto por Dasumo-->
<div align="center">
<form method="post" action="contacto.php" onSubmit="return Validar(this)">
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="200" height="60" align="right" valign="top" scope="col"><img src="imgsCitas/operadoraCitas.gif" width="74" height="61" alt=""></th>
<td width="10" align="left" valign="baseline" bgcolor="#FFFFFF" scope="col"> </td>
<td align="left" valign="baseline" bgcolor="#FFFFFF" scope="col"><p>
<p>Citas</td>
</tr>
<tr>
<td height="25" align="right" scope="col">Nombre:<br></td>
<th align="left" scope="col"> </th>
<th align="left" scope="col"><input id="name" name="name" type="text" size="30"></th>
</tr>
<tr>
<td height="25" align="right" scope="col">Correo Electrónico:<br></td>
<th align="left" scope="col"> </th>
<th align="left" scope="col"><input name="email" type="text" id="email" size="30"></th>
</tr>
<tr>
<td height="25" align="right" scope="col">Teléfono particular:<br></td>
<th align="left" scope="col"> </th>
<th align="left" scope="col"><input id="homephone" name="homephone" type="text" size="30"></th>
</tr>
<tr>
<td height="25" align="right" scope="col">Teléfono trabajo:</td>
<th align="left" scope="col"> </th>
<th align="left" scope="col"><input id="jobphone" name="jobphone" type="text" size="30"></th>
</tr>
<tr>
<td height="25" align="right" scope="col">Celular:</td>
<th align="left" scope="col"> </th>
<th align="left" scope="col"><label>
<input type="text" name="cellphone" id="cellphone" size="30">
</label></th>
</tr>
<tr>
<td height="25" align="right" scope="col">Fecha de cita:<br></td>
<th align="left" scope="col"> </th>
<th align="left" scope="col"><label>
<input type="text" size="26" name="date" id="fecha" readonly="readonly">
<img src="css/calendario.gif" id="selector" />
</label></th>
</tr>
<tr>
<td height="25" align="right" scope="col">Preferentemente:</td>
<th align="left" scope="col"> </th>
<th align="left" scope="col"><label>
<select name="preferentemente" id="preferentemente">
<option selected>Seleccione</option>
<option>mañaba</option>
<option>tarde</option>
<option>indistinto</option>
</select>
</label></th>
</tr>
<tr>
<td height="25" align="right" scope="col">Referido por:<br></td>
<th align="left" scope="col"> </th>
<th align="left" scope="col"><label>
<!--<input type="text" size="30" name="rpor" id="rpor"> -->
<select name="rpor" id="rpor">
<option>Seleccione</option>
<option>Cartel</option>
<option>Médico</option>
<option>Paciente</option>
<option>Otro</option>
</select>
</label></th>
</tr>
<tr>
<td height="25" align="right" scope="col">Mensaje:<br> </td>
<th scope="col"> </th>
<th scope="col"> </th>
</tr>
<tr>
<th height="100" colspan="3" align="right" scope="col"><textarea name="message" id="message" rows="5" cols="25"></textarea></th>
</tr>
<tr>
<td height="25" align="right" scope="col">Teléfono de la Clínica:</td>
<td align="left" scope="col"> </td>
<td align="left" scope="col">58722982</td>
</tr>
<tr>
<td height="25" align="right" scope="col">Correo de la Clínica:</td>
<td scope="col"> </td>
<td scope="col">[email protected]</td>
</tr>
<tr>
<th height="25" scope="col"> </th>
<th scope="col"> </th>
<th scope="col"><input type="submit" name="submit" value="Enviar" /></th>
</tr>
</table>
<label for="email"><br></label>
<label for="message"><br>
</label>
</form>
</div>
<!-- Fin Formulario de contacto -->
-----------------script-valida-formulario-------validar.js---------------------------------------
//Función que verifica campos del formulario vacíos
function Validar(f) {
if (f.name.value=='') {
alert("Por favor escriba su Nombre completo");
f.name.focus();
return (false);
}
if (f.email.value==''){
alert("Por favor escriba su dirección de correo eléctronico");
f.email.focus();
return(false);
}
//validamos los campos telefonicos
/*if (f.homephone.value=='' && f.jobphone.value=='' && f.cellphone.value==''){
alert("Por favor escriba su numero de teléfono particular");
f.homephone.focus();
return(false);
}*/
if(((f.homephone.value=='')&&(f.jobphone.value=='' )&&(f.cellphone.value==''))){
alert("Estimado usuario es importante que al menos nos proporcione un numero de telefono");
f.homephone.focus();
return(false);
}
/* else{
f.homephone.focus();
return(false);
}*/
/* else {
if(((f.homephone.value=='')&&(f.jobphone.value=='' )&&(f.cellphone.value==''))){
alert("Estimado usuario es importante que al menos proporcione un numero de telefono");
f.homephone.focus();
return(false);
}
}*/
//terminamos de validar los campos telefonicos
if (f.fdate.value=='') {
alert("Por favor seleccione en el calendario la fecha deseada de su cíta");
f.fdate.focus();
return(false);
}
if ((f.preferentemente.value=='Seleccione')||(f.prefe rentemente.value=='')){
alert("Por favor seleccione una opción");
f.preferentemente.focus();
return(false);
}
if ((f.rpor.value=='Seleccione')||(f.rpor.value=='')) {
alert("Por favor seleccione una opción.");
f.rpor.focus();
return(false);
}
if (f.message.value=='') {
alert("Por favor escriba su Mensaje.");
f.message.focus();
return(false);
}
}
------------------------------------------------------------------------------------------------------
gracias por su apoyo