|
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 |
diogoweb Smarty Rookie
Joined: 15 Apr 2005 Posts: 6 Location: Brasil
|
Posted: Sat Apr 16, 2005 4:02 am Post subject: In Refresh , the erro messengers show... (?) |
|
|
When the form is generated for the first time, ok. When the user click REFRESH, the messages of errors appear before submit.
Why?
[php:1:921061a6b7]<?php
validator.php
<?PHP session_start();
require('libs/smarty/Smarty.class.php');
require('libs/smarty/SmartyValidate.class.php');
$smarty =& new Smarty;
// required initialization
SmartyValidate::connect($smarty,true);
if(empty($_GET)) {
$smarty->display('form.tpl');
} else {
// validate after a POST
if(SmartyValidate::is_valid($_GET)) {
// no errors, done with SmartyValidate
SmartyValidate::disconnect();
$smarty->display('success.tpl');
} else {
// error, redraw the form
$smarty->assign($_GET);
$smarty->display('form.tpl');
}
}
?>
form.tpl
<form method="GET" action="validator.php">
Full Name: <input type="text" name="FullName">
{validate field="FullName" criteria="notEmpty" message="Full Name cannot be empty"}
<p>
Date: <input type="text" name="test">
{validate field="test" criteria="notEmpty" message="Full Name cannot be empty"}
<input type="submit">
</form>
?>[/php:1:921061a6b7]
tnks... _________________ "Abre seus braços meu irmão , deixa cair... Pra que somar se agente pode dividir..." |
|
Back to top |
|
migas Smarty Regular
Joined: 07 Apr 2004 Posts: 73 Location: Porto, Portugal
|
Posted: Sat Apr 16, 2005 6:31 pm Post subject: |
|
|
Try using the form with the metoth POST because normaly your PHP's has some values in the $_GET.
Type in your script phpinfo(32);
#32 will only show you the system Var's.
Boas Linhas |
|
Back to top |
|
diogoweb Smarty Rookie
Joined: 15 Apr 2005 Posts: 6 Location: Brasil
|
Posted: Sat Apr 16, 2005 10:32 pm Post subject: |
|
|
migas wrote: | Try using the form with the metoth POST because normaly your PHP's has some values in the $_GET.
Type in your script phpinfo(32);
#32 will only show you the system Var's.
Boas Linhas |
I tried, but the error continues. (with post,get, or a control variable in hidden)
_________________ "Abre seus braços meu irmão , deixa cair... Pra que somar se agente pode dividir..." |
|
Back to top |
|
migas Smarty Regular
Joined: 07 Apr 2004 Posts: 73 Location: Porto, Portugal
|
Posted: Sun Apr 17, 2005 7:36 pm Post subject: |
|
|
Post the error here |
|
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
|