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

[SmartyValidate] Warning: Smarty error: validate

 
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
annuh
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

Hello,
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:

registratie.php
Code:

<?php
$smarty->assign('content_title','Registreren');
require_once('smarty/libs/SmartyValidate.class.php');
if(empty($_POST)) {
        SmartyValidate::connect($smarty, true);
        SmartyValidate::register_validator('fusername','Username','notEmpty');
        SmartyValidate::register_validator('fwachtwoord1','Wachtwoord1','notEmpty');
        SmartyValidate::register_validator('fwachtwoord2','Wachtwoord2','notEmpty');
        SmartyValidate::register_validator('femail','Email','notEmpty');         
        $smarty->assign('template', 'registratie.tpl');
    } else {     
        SmartyValidate::connect($smarty);
       // validate after a POST
       if(SmartyValidate::is_valid($_POST)) {
           // no errors, done with SmartyValidate
           SmartyValidate::disconnect();
           echo 'Gelukt!';
       } else {
           // error, redraw the form
           $smarty->assign($_POST);
           $smarty->assign('template', 'registratie.tpl');
       }
    }
?>



registratie.tpl
Code:

<?php
<form name="registreer" method="post" action="{$domein}/profiel/registreren" enctype="multipart/form-data">
    Om te registeren moet je onderstaand formulier even invullen!     
    <fieldset>
        <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}"/>
    </fieldset>
// Nog meer inputs...         
            <fieldset>
            <legend>Controleren</legend>
            <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!">
            </fieldset>
            <input type="hidden" name="registreer_form" value="1"> 
            </form>
?>


index.php
Code:
<?php
require_once('smarty/libs/Smarty.class.php');
$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;
$smarty->display('index.tpl');

?>


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:   
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