Smarty Validate
| From: | Reynier Perez Mira | Date: | Sat, 23 Apr 2005 03:28:33 +0000 |
| Subject: | Smarty Validate | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-12538@lists.php.net to get a copy of this message | ||
Well list:
Few weeks ago I begin use SmartyValidate and all it's ok. But I move my site to another server
and I have some problems now. This is my code PHP:
if(empty($_POST)) {
SmartyValidate::connect($template, true);
SmartyValidate::register_validator('username','uname','notEmpty',false);
SmartyValidate::register_validator('useremail','umail','notEmpty',false);
SmartyValidate::register_validator('useremail','umail','isEmail',false);
SmartyValidate::register_validator('ucomments','ucomments','notEmpty',false);
$template->display("guestbook_sign.tpl");
}else{
SmartyValidate::connect($template);
if(SmartyValidate::is_valid($_POST)) {
SmartyValidate::disconnect();
$template->display('guestbook_show.tpl');
}else{
$template->assign($_POST);
$template->display("guestbook_sign.tpl");
}
after I included all need library and initialize all vars. Something like this:
require("./class/smarty/Smarty.class.php");
require('./class/smarty/SmartyPaginate.class.php');
require('class/smarty/SmartyValidate.class.php');
$template = new Smarty();
so this is part of my .tpl code in wich I try to validate some fields:
....
<td>
{validate id="ucomments" message="Debes introducir algún comentario antes de firmar
el Libro"}
<textarea name="ucomments" cols="55" rows="8"
wrap="VIRTUAL" id="ucomments"></textarea>
</td>
....
The error appear in broswer is:
Notice: Undefined offset: 1 in D:\WWW\jclub\class\smarty\SmartyValidate.class.php on line 417 (just
at the top)
Warning: Smarty error: validate: validator id 'ucomments' is not registered. in
D:\WWW\jclub\class\smarty\Smarty.class.php on line 1088 (after textarea)
What's wrong? I not understand why if I move the site to another host and not touch anything of
code and the order of folders is the same, how can pass this.
Regards
Reynier Pérez Mira
3ero. Ing. Informática
Entre más inteligente me siento, más me doy cuenta de lo ignorante que soy.