Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

[SmartyValidate] Warning: Smarty error: validate

Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
Smarty n00b

Joined: 12 Mar 2008
Posts: 1

PostPosted: Wed Mar 12, 2008 3:42 pm    Post subject: [SmartyValidate] Warning: Smarty error: validate Reply with quote

I'm trying to make a website with Smarty with soms forms. That is possible with SmartyValidate of course, but I when I made a form, I'll get the following errors:
Warning: Smarty error: validate: validator id 'fusername' is not registered. in C:\xampp\htdocs\smarty\libs\Smarty.class.php on line 1095 and some more, but with other id's.

Here are my codes:


if(empty($_POST)) {
        SmartyValidate::connect($smarty, true);
        $smarty->assign('template', 'registratie.tpl');
    } else {     
       // validate after a POST
       if(SmartyValidate::is_valid($_POST)) {
           // no errors, done with SmartyValidate
           echo 'Gelukt!';
       } else {
           // error, redraw the form
           $smarty->assign('template', 'registratie.tpl');


<form name="registreer" method="post" action="{$domein}/profiel/registreren" enctype="multipart/form-data">
    Om te registeren moet je onderstaand formulier even invullen!     
        <legend>Account Gegevens</legend>
            {validate id="fusername" message="Vul een gebruikersnaam in!"}
        <label for="username">Username</label> <input type="text" name="Username" id="username" /><br />
            {validate id="fwachtwoord1" message="Vul een wachtwoord in!<br>"}
        <label for="wachtwoord">Wachtwoord</label> <input type="password" name="Wachtwoord1"/><br />
            {validate id="fwachtwoord2" message="Vul ook hier een wachtwoord in!<br>"}             
        <label for="wachtwoord2">Wachtwoord <i>(controle)</i> </label> <input type="password" name="Wachtwoord2" id="wachtwoord2"/><br />
            {validate id="femail" message="Vul een geldig emailadres in!<br>"}
        <label for="email">E-mail</label> <input type="text" name="Email" id="email" value="{$email|escape}"/>
// Nog meer inputs...         
            <label for="akkoord">Ik ga akkoord met de regels</label><input type="checkbox" name="akkoord" id="akkoord"><br /><br />
            <input type="submit" class="submit" value="Versturen!">
            <input type="hidden" name="registreer_form" value="1"> 

$smarty = new Smarty();
$smarty->template_dir = 'smarty/templates/';
$smarty->compile_dir  = 'smarty/templates_c/';
$smarty->config_dir   = 'smarty/configs/';
$smarty->cache_dir    = 'smarty/cache/';

$smarty->assign('domein', 'http://localhost');

$pad = explode('/', $_SERVER['REQUEST_URI']);

$smarty->assign('location', $pad[1]);

$onderdeel = $pad[1];
$pagina = $pad[2];

if ($onderdeel == '') {
    // de code voor nieuwspagina's
    include ('home.php');

if ($onderdeel == 'profiel') {
    if ($pagina == 'registreren') {
    include ('profiel/registratie.php');

//** un-comment the following line to show the debug console
$smarty->debugging = true;


What am I doing wrong? Could someone please help me? Rolling Eyes
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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