|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
dscriptor Smarty Rookie
Joined: 27 Jul 2006 Posts: 16 Location: Philippines
|
Posted: Thu Jul 27, 2006 12:41 pm Post subject: Smarty Validate - validator id 'fnm' is not registered. |
|
|
hi all,
can somebody help me why im having this error? it's my first time to use this SmartyValidator.
the error:
Warning: Smarty error: validate: validator id 'fnm' is not registered. in
my PHP code is [php:1:c4dd711449]
if(empty($_POST)) {
SmartyValidate::connect($smarty, true);
SmartyValidate::register_validator('fnm', 'fnm', 'notEmpty',false, false, 'trim');
// display form
$smarty->display("admin/addcontact.tpl");
}
[/php:1:c4dd711449]
my .tpl :
Code: |
<tr>{validate id="fnm" message="First Name Cannot Be Empty"}
<td align="right">First Name: </td>
<td align="left"><input name="fnm" type="text" size="18" value="{$fnm|escape}"/></td>
|
am i doing doing right here?
please help me here..
thanks! |
|
Back to top |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Thu Jul 27, 2006 3:55 pm Post subject: |
|
|
session started? |
|
Back to top |
|
dscriptor Smarty Rookie
Joined: 27 Jul 2006 Posts: 16 Location: Philippines
|
Posted: Fri Jul 28, 2006 2:56 am Post subject: |
|
|
yes, session started first... |
|
Back to top |
|
dscriptor Smarty Rookie
Joined: 27 Jul 2006 Posts: 16 Location: Philippines
|
Posted: Fri Jul 28, 2006 4:26 am Post subject: somehow i resolved it..but ... |
|
|
i resolved it by..
changing the ff:
Code: | {validate id="fname" message="Full Name cannot be empty"} |
to:
Code: | {$validate id="fname" message="Full Name cannot be empty"} |
i just put $ sign before the word 'validate'..
no more error like the one above...but no message is displaying about the validation error...
i was thinking why do i have to put $ sign in the word 'validate'... is it right?
or i'm wrong in what im doing..?
please help me here...thanks! |
|
Back to top |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Fri Jul 28, 2006 1:11 pm Post subject: |
|
|
with the $ sign is not correct |
|
Back to top |
|
liutianxi Smarty n00b
Joined: 12 Aug 2007 Posts: 1
|
Posted: Sun Aug 12, 2007 1:55 pm Post subject: Is because empty($_POST) if false. |
|
|
I have the same problem. And I find it's because the $_POST is not empty.
So, replace
Code: |
if(empty($_POST)) {
|
with
Code: |
if(!isset($_SESSION['form_first_time'])){
$_SESSION['form_first_time'] = true;
|
.Everything is OK. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|