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

validates but doesn't show success.tpl

 
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
thiebo
Smarty Pro


Joined: 16 Jan 2005
Posts: 144
Location: Paris

PostPosted: Sat Jan 29, 2005 4:47 pm    Post subject: validates but doesn't show success.tpl Reply with quote

Hello,

I have just installed SmartyValidate and it seems great to me and I am testing it with the files provided by the README (index.php, form.tpl and success.tpl) I just have a quite important problem : it verifies the criteria all right and sends the correct message when criteria are not met, but once the form is completed, and I try to validate it, it does not show success.tpl

Here's my index.php :

[php:1:92399eb339]<?php
session_start();
// you will need to setup Smarty if
// the defaults are not correct.

require ('/usr/local/lib/php/Includes/smartysite/setup.php');
require('SmartyValidate.class.php');

$smarty = &new Smarty_smartysite;


// required initialization
SmartyValidate::connect($smarty);

if(empty($_POST)) {
$smarty->display('/var/www/html/smarty/templates/form.tpl');
} else {
// validate after a POST
if(SmartyValidate::is_valid($_POST)) {
// no errors, done with SmartyValidate
SmartyValidate::disconnect();
$smarty->display('success.tpl');
} else {
// error, redraw the form
$smarty->assign($_POST);
$smarty->display('form.tpl');
}
}

?>

?>[/php:1:92399eb339]


and form.tpl :


Code:
<HTM><HEAD><TITLE>TEST</TITLE></HEAD>

<BODY>
   
   <form method="post" action="index.php">

    {validate field="FullName" criteria="notEmpty" transform="trim" message="Full Name Cannot Be Empty"}
    Full Name: <input type="text" name="FullName" value="{$FullName|escape}"><br />

    {validate field="Phone" criteria="isNumber" empty="yes" transform="trim" message="Phone Number Must be a Number"}
    Phone :<input type="text" name="Phone" value="{$Phone|escape}" empty="yes"><br />

    {validate field="Email" criteria="isEmail" transform="trim" message="Email not valid"}
    Email: <input type="text" name="Email" size="30" value="{$Email|escape}"><br />

    {validate field="Date" criteria="isDate" empty="true" transform="trim" message="Date not valid"}
    Date: <input type="text" name="Date" size="10" value="{$Date|escape}"><br />

    {validate field="password" criteria="isEqual" field2="password2" message="passwords do not match"}
    password: <input type="password" name="password" size="10" value="{$password|escape}"><br />
    password2: <input type="password" name="password2" size="10" value="{$password2|escape}"><br />

    <input type="submit">
    </form>   

</BODY>
</HTML>




I probably has to do with my error messages :

Quote:
[client 127.0.0.1] PHP Notice: Undefined index: CCExpDate in /var/www/html/smartysite/SmartyValidate.class.php on line 152, referer: http://localhost/smartysite/index.php
[client 127.0.0.1] PHP Notice: Undefined index: CCExpDate in /var/www/html/smartysite/SmartyValidate.class.php on line 158, referer: http://localhost/smartysite/index.php
[client 127.0.0.1] PHP Notice: Undefined index: nom in /var/www/html/smartysite/SmartyValidate.class.php on line 152, referer: http://localhost/smartysite/index.php
[client 127.0.0.1] PHP Notice: Undefined index: nom in /var/www/html/smartysite/SmartyValidate.class.php on line 158, referer: http://localhost/smartysite/index.php
[client 127.0.0.1] PHP Notice: Undefined index: prenom in /var/www/html/smartysite/SmartyValidate.class.php on line 152, referer: http://localhost/smartysite/index.php
[client 127.0.0.1] PHP Notice: Undefined index: prenom in /var/www/html/smartysite/SmartyValidate.class.php on line 158, referer: http://localhost/smartysite/index.php
[client 127.0.0.1] PHP Notice: Undefined index: email in /var/www/html/smartysite/SmartyValidate.class.php on line 152, referer: http://localhost/smartysite/index.php
[client 127.0.0.1] PHP Notice: Undefined index: email in /var/www/html/smartysite/SmartyValidate.class.php on line 158, referer: http://localhost/smartysite/index.php


These messages are really funny since SmartyValidate.class.php and index.php do not contain the words prenom, email and nom.... Those are used in another form I use.

Does anyone have a clue what I did wrong ?

Thanks,

Thiebo
Back to top
View user's profile Send private message Visit poster's website
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