Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/02/2013, 16:31
alfadaemon
 
Fecha de Ingreso: mayo-2012
Mensajes: 23
Antigüedad: 12 años
Puntos: 1
Condicion en boton radio

Hola a todos los maquinas del forosdelweb.
Estoy aprendiendo javascript y tengo un problema.
Os comento.
Tengo un formulario con 3 input tipo radio y al lado de este input tipo radio hay un input tipo text para rellenar dependiendo del radio marcadado.
Os pongo aqui el formulario:
Código HTML:
<html>
<head><title>Formulario Prueba</title></head>
<body>
<form name="form_prueba" action="datos.php" method="Post">
<fieldset>
<legend>¿CÓMO DESEA RECIBIR EL PRESUPUESTO?</legend>
<div>
<table>
<tr>
<td class="td-class3">
<input name="f_envio" type="radio" value="CORREO" class="texto" id="id1"/> Por correo ordinario. <strong>Dirección</strong>
</td>
</tr>
<tr>
<td>
<input name="e_direccion" type="text" class="texto" id="e_direccion" size="25" maxlength="25" />
</td>
</tr>
<tr>
<td class="td-class3">
<input name="f_envio" type="radio" value="EMAIL" class="texto" checked id="id2" /> Por correo electrónico. <strong>Email</strong>
</td>
</tr>
<tr>
<td>
<input name="e_email" type="text" class="texto" id="e_email" size="25" maxlength="25" />
</td>
<tr>
<td class="td-class3">
<input name="f_envio" type="radio" value="DESPACHO" class="texto"> Solicitando cita en el despacho de la administración.
</td>
</tr>
</table>
</div>
</fieldset>
<div>
<input type="submit" id="enviar" class="fade" name="enviar" value="Enviar" />
</div>
</form>
</body>
</html> 
Lo que quiero es que antes de enviar el formulario, éste, se valide si el dato del input tipo text fue rellenado pero dependiendo del radio marcado.
Ej:. Si marco el radio email "Que quiero recibir el presupuesto por email", que me lleve al input tipo text para rellenarlo con el email y si se me olvida rellenarlo al enviar el formulario que aparezca un mensaje "DEBES RELLENAR EL CAMPO EMAIL".
Alguien me puede ayudar con este reto?
Gracias de antemano.