|
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 |
thiebo Smarty Pro
Joined: 16 Jan 2005 Posts: 144 Location: Paris
|
Posted: Thu Feb 04, 2016 9:22 pm Post subject: smartyValidate Undefined index: message and [validate plugin |
|
|
Hi,
Strangly having difficulties getting SmartyValidate to work....
This is my index.php :
Code: | <?php
session_start();
error_reporting(E_ALL);
require('../smartysetup.php');
require('../libs/SmartyValidate.class.php');
require(DOSS_PASS.'pass.php');
$smarty = new Smarty_ChirHadach();
require('../menu.php');
require('../noms_templates.php');
require('../cherche_articles.php');
$smarty->assign ('outil','nl');
$smarty->assign ('template',$template);
if(empty($_POST)){
SmartyValidate::connect($smarty, true);
SmartyValidate::register_form($index_template);
SmartyValidate::register_validator('fprenom','prenom','notEmpty');
SmartyValidate::register_validator('fnom','nom','notEmpty');
SmartyValidate::register_validator('femail','email','isEmail');
$smarty->assign ('titre','Souscrire à la newsletter');
$smarty->assign ('message','Newsletter');
$smarty->display($index_template);
}
else {
SmartyValidate::connect($smarty);
if(SmartyValidate::is_valid($_POST)){
SmartyValidate::disconnect();
$smarty->display ('index_chirhadach.tpl');
}else{
$smarty->assign($_POST);
$smarty->display($index_template);
}
}
?> |
And in my template I have this :
Code: | <div class="form-group">
<p>
{validate id="fprenom" message="Il faut remplir son prénom"}
</p>
<label for="inputPrenom" class="col-sm-2 control-laber">Prénom *</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="prenom" name="prenom" placeholder="Prénom">
</div>
</div>
<div class="form-group">
<p>
{validate id="fnom" message="Il faut remplir son nom"}
</p>
<label for="inputNom" class="col-sm-2 control-laber">Nom *</label>
<div class="col-sm-10">
<input type="nom" class="form-control" id="nom" name="nom" placeholder="Nom">
</div>
</div> |
But then I get this error message :
Quote: | Notice: Undefined index: message in /var/www/html/chirhadach/smarty/templates_c/88c2de60066e7e4c5cd8a170e4d3c68fa3285039_0.file.newsletter.tpl.php on line 38 |
I have the impression I followed the instructions for installing SmartyValidate and the php and tpl, but something is going wrong... |
|
Back to top |
|
thiebo Smarty Pro
Joined: 16 Jan 2005 Posts: 144 Location: Paris
|
Posted: Fri Feb 05, 2016 10:12 am Post subject: |
|
|
Hi,
No-one sees what could be wrong ?
I went through this over and over and I'm not seeing something.
Thanks a lot for any help or clue.... |
|
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
|