|
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 |
dawei Smarty Rookie
Joined: 14 Dec 2006 Posts: 11
|
Posted: Tue Jan 02, 2007 3:41 pm Post subject: [quickform et smarty] Probleme d'affichage |
|
|
dans la partie php:
Code: |
//affectation de tous les elements de personne(client) dans un tableau
$tableau_personne= Array();
$tableau_personne = 'var tableau = Array();';
foreach($tab_personne_tous as $element){
$tableau_personne .='tableau['.$element['no'].'] ={"nom": \''.$element['nom'].'\',"prenom":\''.$element['prenom'].'\'};';
}
$smarty->assign('tab_personne',$tableau_personne);
//affectation de tous les elements de personne2(sous-client) dans un tableau
$tableau_personne2= Array();
//var_dump($tab_personne2_tous);
$tableau_personne = 'var tableau2 = Array();';
foreach($tab_personne2_tous as $element){
$tableau_personne .='tableau['.$element['no'].'] ={"nom": \''.$element['nom'].'\',"prenom":\''.$element['prenom'].'\'};';
}
$smarty->assign('tab_personne2',$tableau_personne2);
|
Dans la partie template:
Code: |
{literal}
<script type="text/javascript">
// pour le tableau personne1
function verifPseudo(noclient){
{/literal}
{$tab_personne}
{literal}
document.forms['editer_client'].elements['nom_personne'].value=tableau[noclient]['nom'];
document.forms['editer_client'].elements['prenom_personne'].value=tableau[noclient]['prenom'];
}
function verifPseudo2(nosociete){
{/literal}
{$tab_personne2}
{literal}
alert(tableau2[no]['nom']); document.forms['editer_client'].elements['nom_societe'].value=tableau2[nosociete]['nom'];
}
</script>
{/literal}
|
Avec un seul tableau, il n'y a pas de probleme mais avec 2, vive les degats. Le formulaire ne fonctionne plus
Merci _________________ /\_ Le forum est là lorsqu'on a besoin d'aide. _/\ |
|
Back to top |
|
ciboulette Smarty Regular
Joined: 13 Jul 2006 Posts: 45
|
Posted: Tue Jan 02, 2007 10:17 pm Post subject: |
|
|
pas j'ai pas compris se que doit faire ton code de base |
|
Back to top |
|
dawei Smarty Rookie
Joined: 14 Dec 2006 Posts: 11
|
Posted: Thu Jan 25, 2007 12:08 pm Post subject: |
|
|
bonjour,
ce que je voulais faire, c'etait de generer plusieur tableau et recuperer dans la template le reultat du tableau
Probleme réglé, enfin! _________________ /\_ Le forum est là lorsqu'on a besoin d'aide. _/\ |
|
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
|