| Reynier Perez Mira 2006-01-30, 7:05 pm |
| Hi to every body again. I still with problems. I don't know why this =
happened. If any can help me?=20
Regards
ReynierPM
4to. a=F1o Ing. Inform=E1tica
Usuario registrado de Linux: #310201
****************************************
*********************************=
El programador superh=E9roe aprende de compartir sus conocimientos.=20
Es el referente de sus compa=F1eros. Todo el mundo va a preguntarle y =
=E9l, secretamente, lo fomenta porque es as=ED como adquiere su =
legendaria
sabidur=EDa: escuchando ayudando a los dem=E1s...=20
-----Mensaje original-----
De: Reynier Perez Mira=20
Enviado el: Friday, January 27, 2006 9:40 PM
Para: Monte Ohrt
CC: smarty-general@lists.php.net
Asunto: RE: [SMARTY] SmartyValidate 2.6 and Smarty 2.6.12 doesn't work =
....
Hi:
I still with SmartyValidate problems. After a rechecking for entire =
documentation in "Incutio", I found some elements to test if I do the =
right or not. The first is test is form are registered or not. So I =
rewrite again my old code and this is the way:
****************************************
**************************
if(empty($_POST)){
SmartyValidate::connect($tpl, true);
/* If I understand doc the form have not name is call 'default' but my =
form=20
has a name and a id in this way: <form name=3D"uRegister" id=3D" =
uRegister */
">. So I need to register my form in the way under */ =
SmartyValidate::register_form('uRegistro
');
/* Then I test if form was register or not */
if(!SmartyValidate::is_registered_form('
uRegistro')){
echo "Don't registered yet";
}else{
echo "Registered form";
}
/* This print "Registered form" */
/* Then I register some validators needed */ =
SmartyValidate::register_validator('fnom
bre','uNombre','notEmpty');
=
SmartyValidate::register_validator('fape
llidos','uApellidos','notEmpty');=
=
SmartyValidate::register_validator('fdir
eccion','uDireccion','notEmpty');=
SmartyValidate::register_validator('fcor
reo','uCorreo','isEmail');
SmartyValidate::register_validator('fusu
ario','uUsuario','notEmpty');
SmartyValidate::register_validator('fpas
sword','uPsw1:uPsw2', =
'isEqual');
/* I assign a template var because in a template according to the value =
taken for this var (display) I include some files */ =
$tpl->assign('display','register');
}else{
/*Here I don't change nothing because is the standard procedure for =
follow*/ SmartyValidate::connect($tpl);
if(SmartyValidate::is_valid($_POST)) {
SmartyValidate::disconnect();
$tpl->display('success.tpl');
} else {
$tpl->assign($_POST);
$tpl->display('form.tpl');
}
}
****************************************
**************************
So I rechecking again documentation and find another sutff but now about =
templates. So I reprogramming again my old code and now this is:
****************************************
**************************
<!-- User register form -->
<fieldset><legend>{#REGISTER_TITLE#|escape:"htmlall"}</legend>
<form name=3D"uRegistro" id=3D"uRegistro" method=3D"post" =
action=3D"inser_user.php"> <table align=3D"center" cellpadding=3D"1" =
cellspacing=3D"1"> <tr> <td width=3D"89" class=3D"derecha">Nombre:</td> =
<td width=3D"144"><input type=3D"text" name=3D"uNombre" id=3D"uNombre" =
size=3D"35" maxlength=3D"35" value=3D"{$uNombre}">
/* In doc I found that {validate} tags require a parameter call =
criteria, this is optional or not? I'm lost here at this point. So I add =
this parameter to all my {validate} tags */ {validate id=3D"fnombre" =
criteria=3D"notEmpty" message=3D"El campo Nombre no puede estar vacio"} =
</td></tr> <tr><td class=3D"derecha">Apellidos:</td> <td><input =
type=3D"text" name=3D"uApellidos" id=3D"uApellidos" size=3D"35" =
maxlength=3D"45" value=3D"{$uApellidos}"> {validate id=3D"fapellidos" =
criteria=3D"notEmpty" message=3D"El campo Apellidos no puede estar =
vacio"} </td></tr> <tr><td class=3D"derecha">Dirección:</td>
<td><textarea name=3D"uDireccion" id=3D"uDireccion" cols=3D"35" =
rows=3D"5">{$uDireccion}</textarea> {validate id=3D"fdireccion" =
criteria=3D"notEmpty" message=3D"El campo Direccion no puede estar =
vacio"} </td></tr> <tr><td class=3D"derecha">eCorreo:</td> <td><input =
type=3D"text" name=3D"uCorreo" id=3D"uCorreo" size=3D"45" =
maxlength=3D"150" value=3D"{$uCorreo}"> {validate id=3D"fcorreo" =
criteria=3D"isEmail" message=3D"El campo Correo Electr=F3nico no puede =
estar vacio"} </td></tr> <tr><td class=3D"derecha">Usuario:</td> =
<td><input type=3D"text" name=3D"uUsuario" id=3D"uUsuario" size=3D"35" =
maxlength=3D"45" value=3D"{$uUsuario}"> {validate id=3D"fusuario" =
criteria=3D"uUsuario" message=3D"El campo Usuario no puede estar vacio"} =
</td></tr> <tr><td class=3D"derecha">Contrase=F1a:</td> <td><input =
type=3D"password" name=3D"uPsw1" id=3D"uPsw1" size=3D"35" =
maxlength=3D"150" value=3D"{$uPsw1}"> {validate id=3D"fpassword" =
criteria=3D"notEmpty" message=3D"Los siguientes errores han ocurrido: El =
campo contrase=F1a esta vacio o las contrase=F1as no coinciden"} =
</td></tr> <tr><td class=3D"derecha">Confirmar contrase=F1a:</td> =
<td><input type=3D"password" name=3D"uPsw2" id=3D"uPsw2" size=3D"35" =
maxlength=3D"150" value=3D"{$uPsw2}"> </td></tr> <tr><td colspan=3D"2" =
class=3D"center"><input type=3D"submit" name=3D"btn_Send" =
value=3D"Enviar"></td></tr> </table></form></fieldset>
****************************************
**************************
So as you can see apparently nothing is wrong here, but when I send the =
form is sending without any validation. It means that if I leave all =
fields empty nothing happen and the form go where they was send, to =
inser_user.php script. So if any body can help, I really miss some part =
of the documentation file or simply I have mistakes in my code?
Best,
ReynierPM
4to. a=F1o Ing. Inform=E1tica
Usuario registrado de Linux: #310201
****************************************
*********************************=
El programador superh=E9roe aprende de compartir sus conocimientos.=20
Es el referente de sus compa=F1eros. Todo el mundo va a preguntarle y =
=E9l, secretamente, lo fomenta porque es as=ED como adquiere su =
legendaria
sabidur=EDa: escuchando ayudando a los dem=E1s...
--
Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, =
visit: http://www.php.net/unsub.php
|