Home > Archive > PHP Smarty Templates > January 2006 > RE: [SMARTY] SmartyValidate 2.6 and Smarty 2.6.12 doesn't work ...
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
RE: [SMARTY] SmartyValidate 2.6 and Smarty 2.6.12 doesn't work ...
|
|
| Reynier Perez Mira 2006-01-23, 7:06 pm |
| Well, I follow your instructions and change the bad code. The code now =
is this:
--------------------------------
if(!SmartyValidate::is_registered_form('
default')) {
SmartyValidate::connect($tpl, true);
SmartyValidate::register_validator('uLog
','uLogin','notEmpty');
SmartyValidate::register_validator('uPas
','uPasswd','notEmpty');
$tpl->display('a_home.tpl');
} else {
SmartyValidate::connect($tpl);
if(SmartyValidate::is_valid($_POST)) {
SmartyValidate::disconnect();
$tpl->display('success.tpl');
} else {
$tpl->assign($_POST);
$tpl->display('a_home.tpl');
}
}
--------------------------------
But when I submit the form and leave fields empty, nothing is =
validate!!! So ... when I click the back button in my FF browser then =
the messages: " El campo usuario no puede estar vac=EDo" and " El campo =
contrase=F1a no puede estar vac=EDo" appears. Why this?
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=20
y =E9l, secretamente, lo fomenta porque es as=ED como adquiere su =
legendaria=20
sabidur=EDa: escuchando ayudando a los dem=E1s...
-----Mensaje original-----
De: Monte Ohrt [mailto:monte@ohrt.com]=20
Enviado el: Monday, January 23, 2006 11:34 am
Para: Reynier Perez Mira
CC: smarty-general@lists.php.net
Asunto: Re: [SMARTY] SmartyValidate 2.6 and Smarty 2.6.12 doesn't work =
....
that is the name of the form. if you didn't name it when you registered, =
then 'default' is correct. You can also leave it empty:
is_registered_form()
Reynier Perez Mira wrote:
>Hi Monte:
>Understand every, but I have one doubt: what's 'default'? a name for a =
form or a id or something ...
>
>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=20
>y =E9l, secretamente, lo fomenta porque es as=ED como adquiere su =
legendaria=20
>sabidur=EDa: escuchando ayudando a los dem=E1s...
>
>-----Mensaje original-----
>De: Monte Ohrt [mailto:monte@ohrt.com]=20
>Enviado el: Monday, January 23, 2006 10:51 am
>Para: Reynier Perez Mira
>CC: smarty-general@lists.php.net
>Asunto: Re: [SMARTY] SmartyValidate 2.6 and Smarty 2.6.12 doesn't work =
....
>
>Monte Ohrt wrote:
>
> =20
>
>
>oops, make that:
>
> if(empty($_POST)) {
>
>I'll note that testing if $_POST is empty isn't always an accurate=20
>approach in every situation, another approach is to test if the form is =
>registered:
>
>if (!SmartyValidate::is_registered_form('de
fault')) {
>
> =20
>
class.[color=darkred]
no=20[color=darkred]
size=3D"35"=20[color=darkred]
contrase=F1a no=20[color=darkred]
http://localhost/admincp/index.php[color=darkred]
[color=darkred]
[color=darkred]
***=20[color=darkred]
Es=20[color=darkred]
=E9l,=20[color=darkred]
>
> =20
>
| |
| Monte Ohrt 2006-01-23, 7:06 pm |
| The form needs reset each time it is "new", so maybe use empty($_POST)
along with the register test:
if(!SmartyValidate::is_registered_form()
|| empty($_POST)) {
Reynier Perez Mira wrote:
>Well, I follow your instructions and change the bad code. The code now is this:
>--------------------------------
> if(!SmartyValidate::is_registered_form('
default')) {
> SmartyValidate::connect($tpl, true);
> SmartyValidate::register_validator('uL
og','uLogin','notEmpty');
> SmartyValidate::register_validator('uP
as','uPasswd','notEmpty');
> $tpl->display('a_home.tpl');
> } else {
> SmartyValidate::connect($tpl);
> if(SmartyValidate::is_valid($_POST)) {
> SmartyValidate::disconnect();
> $tpl->display('success.tpl');
> } else {
> $tpl->assign($_POST);
> $tpl->display('a_home.tpl');
> }
> }
>--------------------------------
>But when I submit the form and leave fields empty, nothing is validate!!! So ... when I click the back button in my FF browser then the messages: " El campo usuario no puede estar vacío" and " El campo contraseña no puede estar vacío" appears. Why this?
>
>
>Regards
>ReynierPM
>4to. año Ing. Informática
>Usuario registrado de Linux: #310201
> ****************************************
*********************************
>El programador superhéroe aprende de compartir sus conocimientos.
>Es el referente de sus compañeros. Todo el mundo va a preguntarle
>y él, secretamente, lo fomenta porque es así como adquiere su legendaria
>sabiduría: escuchando ayudando a los demás...
>
>-----Mensaje original-----
>De: Monte Ohrt [mailto:monte@ohrt.com]
>Enviado el: Monday, January 23, 2006 11:34 am
>Para: Reynier Perez Mira
>CC: smarty-general@lists.php.net
>Asunto: Re: [SMARTY] SmartyValidate 2.6 and Smarty 2.6.12 doesn't work ...
>
>that is the name of the form. if you didn't name it when you registered,
>then 'default' is correct. You can also leave it empty:
>
>is_registered_form()
>
>Reynier Perez Mira wrote:
>
>
>
>
>
>
>
>
>
>
>
>!DSPAM:43d5151d125027126579485!
>
>
>
>
|
|
|
|
|