For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > April 2005 > Smarty Validate









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 Smarty Validate
Reynier Perez Mira

2005-04-23, 3:58 am

Well list:

Few ws 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('user
name','uname','notEmpty',false);
SmartyValidate::register_validator('user
email','umail','notEmpty',false);
SmartyValidate::register_validator('user
email','umail','isEmail',false);
SmartyValidate::register_validator('ucom
ments','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.




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com