Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty Validate - validator id 'fnm' is not registered.

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
dscriptor
Smarty Rookie


Joined: 27 Jul 2006
Posts: 16
Location: Philippines

PostPosted: Thu Jul 27, 2006 12:41 pm    Post subject: Smarty Validate - validator id 'fnm' is not registered. Reply with quote

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
View user's profile Send private message Yahoo Messenger
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Thu Jul 27, 2006 3:55 pm    Post subject: Reply with quote

session started?
Back to top
View user's profile Send private message
dscriptor
Smarty Rookie


Joined: 27 Jul 2006
Posts: 16
Location: Philippines

PostPosted: Fri Jul 28, 2006 2:56 am    Post subject: Reply with quote

yes, session started first...
Back to top
View user's profile Send private message Yahoo Messenger
dscriptor
Smarty Rookie


Joined: 27 Jul 2006
Posts: 16
Location: Philippines

PostPosted: Fri Jul 28, 2006 4:26 am    Post subject: somehow i resolved it..but ... Reply with quote

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
View user's profile Send private message Yahoo Messenger
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Fri Jul 28, 2006 1:11 pm    Post subject: Reply with quote

with the $ sign is not correct
Back to top
View user's profile Send private message
liutianxi
Smarty n00b


Joined: 12 Aug 2007
Posts: 1

PostPosted: Sun Aug 12, 2007 1:55 pm    Post subject: Is because empty($_POST) if false. Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP