
04/02/2009, 17:38
|
| | Fecha de Ingreso: noviembre-2008 Ubicación: lima
Mensajes: 148
Antigüedad: 16 años, 3 meses Puntos: 0 | |
problema con validation.js Hola y gracias de antemano por dedicarme unos segundos.
Estoy intentando validar un formulario con validation.js y prototype.js y el problema es que no me sale el mensaje de error que me debería salir alingresar un valor euqivocado en el input.
Gracias.
y quí les dejo mi código.
index2.php Cita: <?
require('DATOS/Conexion.php'); //conectamos con la base de datos
$MiCon = new Conexion();
session_start();
import_request_variables("GP");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es-es">
<head>
<title>::Viale::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script src="prototype.js" type="text/javascript"></script>
<script src="validation.js" type="text/javascript"></script>
<script type="text/javascript"> new Validation('form-id'); // OR new Validation(document.forms[0]);</script>
<link rel="stylesheet" href="css/menu-1.css" type="text/css" />
</head>
<body>
<?
include("top.php");
$est=true;
if(isset($b)){
include "$b.php";
$est=false;
}
if($est){
include "centro.php";
}
include "abajo.php";
?>
</body>
</html>
edi.php Cita: <head>
<script src="prototype.js" type="text/javascript"></script>
<script src="validation.js" type="text/javascript"></script>
<script type="text/javascript"> new Validation('form-id'); // OR new Validation(document.forms[0]);</script>
<script src="effects.js" type="text/javascript"></script>
</head>
<?
$id=$_SESSION['codigo'];
$query="select * from promotor where cod='".$id."'";
$result=mysql_query($query) or die(mysql_error());
$filas=mysql_fetch_assoc($result);
?>
<style type="text/css">
<!--
.Estilo2 {color: #0000FF}
.Estilo3 {
font-size: 30px;
font-weight: bold;
}
-->
</style>
<head><link rel="stylesheet" href="css/menu-1.css" type="text/css" /></head>
<form method="post" name="form-id" id="form-id"><table width="711" height="526" border="0" align="center">
<tr>
<td height="24" align="center" style="font-family:Arial, Helvetica, sans-serif; font-size12px; color:#000000"> </td>
</tr>
<tr>
<td height="300" align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:36px"><fieldset title="Ficha Personal">
<legend style="font-family:'Trebuchet MS', 'Arial Narrow'; color:#CCCCCC; font-size:12px"> Mi cuenta de Usuario </legend><table width="631" border="0" style="font-family:Arial, Helvetica, sans-serif; font-size:13px">
<tr>
<td colspan="2"><br />
<br /></td>
</tr>
<tr>
<td width="191" height="30"><div align="left"><strong>Nombres :</strong></div></td>
<td width="430" height="30" align="left"><label>
<input name="nombre" type="text" class="input" id="nombre" value="<?=$filas['nombres']?>"/>
</label> </td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Apellido Paterno : </strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<input name="paterno" type="text" class="input" id="paterno" value="<?=$filas['paterno']?>"/>
</div></td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Apellido Materno : </strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<input name="materno" type="text" class="input" id="materno" value="<?=$filas['materno']?>"/>
</div></td>
</tr>
<tr>
<td height="30" align="left"><strong>Razón Social: </strong></td>
<td height="30" align="left"><span class="Estilo2">
<input name="razon" type="text" class="input" id="razon" value="<?=$filas['razon']?>"/>
</span></td>
</tr>
<tr>
<td height="30" align="left"><strong>Ruc:</strong></td>
<td height="30" align="left"><span class="Estilo2">
<input name="ruc" type="text" class="input" id="ruc" value="<?=$filas['ruc']?>"/>
</span></td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Teléfono :</strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<input name="tel1" type="text" class="input" id="tel1" value="<?=$filas['telf1']?>"/>
</div></td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Teléfono 2 :</strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<input name="tel2" type="text" class="input" id="tel2" value="<?=$filas['telf2']?>"/>
</div></td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Celular :</strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<input name="cel1" type="text" class="input" id="cel1" value="<?=$filas['celular1']?>"/>
</div></td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Celular 2 : </strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<input name="cel2" type="text" class="input" id="cel2" value="<?=$filas['celular2']?>"/>
</div></td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Dirección :</strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<input name="dir" type="text" class="input" id="dir" value="<?=$filas['direccion']?>"/>
</div></td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Distrito :</strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<input name="dis" type="text" class="input" id="dis" value="<?=$filas['distrito']?>"/>
</div></td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Provincia :</strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<input name="pro" type="text" class="input" id="pro" value="<?=$filas['provincia']?>"/>
</div></td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Departamento :</strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<input name="dep" type="text" class="input" id="dep" value="<?=$filas['departamento']?>"/>
</div></td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Email asociado a la cuenta : </strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<input name="mail1" type="text" class="input" id="mail1" value="<?=$filas['email1']?>" disabled="disabled"/>
</div></td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Email 2: </strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<input name="mail2" type="text" class="input" id="mail2" value="<?=$filas['email2']?>"/>
</div></td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Estado civil : </strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<label>
<? $est=$filas['civil'];?>
<select name="civil" class="input" id="civil">
<option value="Soltero" <? if($est=='Soltero') {echo 'Selected';}?>>Soltero</option>
<option value="Casado" <? if($est=='Casado') {echo 'Selected';}?>>Casado</option>
<option value="Divorciado" <? if($est=='Divorciado') {echo 'Selected';}?>>Divorciado</option>
<option value="Viudo" <? if($est=='Viudo') {echo 'Selected';}?>>Viudo</option>
</select>
</label>
</div></td>
</tr>
<tr>
<td height="30"><div align="left"><strong>Número de hijos: </strong></div></td>
<td height="30" align="left"><div align="left" class="Estilo2">
<input name="hijos" type="text" class="required validate-number" id="hijos" value="<?=$filas['hijos']?>"/>
</div></td>
</tr>
<tr>
<td height="30"> </td>
<td height="30"> </td>
</tr>
<tr>
<td height="30" colspan="2" align="center"><label>
<input name="envia" type="submit" id="envia" value="Enviar" />
</label></td>
</tr>
<tr>
<td height="15"> </td>
<td height="15"> </td>
</tr>
</table>
</fieldset></td>
</tr>
</table></form>
<?
if($_POST['envia'])
{
$nom=$_POST['nombre'];
$pate=$_POST['paterno'];
$mat=$_POST['materno'];
$razon=$_POST['razon'];
$ruc=$_POST['ruc'];
$telf=$_POST['tel1'];
$telf2=$_POST['tel2'];
$cel=$_POST['cel1'];
$cel2=$_POST['cel2'];
$direc=$_POST['dir'];
$dist=$_POST['dis'];
$prov=$_POST['pro'];
$dep=$_POST['dep'];
$email2=$_POST['mail2'];
$civi=$_POST['civil'];
$hijos=$_POST['hijos'];
$sql="UPDATE promotor set nombres='$nom', paterno='$paterno', materno='$materno', razon='$razon', ruc='$ruc', telf1='$telf', telf2='$telf2', celular1='$cel', celular2='$cel2', direccion='$direc', distrito='$dist', provincia='$prov', departamento='$dep', email2='$email2', civil='$civi', hijos='$hijos'";
mysql_query($sql) or die(mysql_error());
echo "<script>alert('Operacion realizada satisfactoriamente.')</script>";
echo "<script>document.location='index2.php?b=per'</script>";
}
?>
|