|
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: Fri Dec 15, 2006 2:30 pm Post subject: affectation javascript et $form->setDefaults() |
|
|
bonjour tout le monde,
Admettons que j'ai en entrée : aaaa, cette valeur est transmise dans le javascript par appel d'une fonction testjs() par exemple. On quitte la partie php maintenant...
Dans la section javascript, lorsque je fais alert( nom), il m'affiche "aaaa".
Mais, apres avoir verifier le nom avec celui qui est dans la base de donnée. Si le nom correspond, je créé un nouveau champs "mot de passe "avec comme valeur: "saisir un mot de passe". Je ne vois pas comment rajouter et aussi comment modifier un champ existant.
mon code a cette tete là:
Code: |
dans php:
<?php
$data = array('1' => 'marc', '2' => 'alex', '2' => 'sophie', '3' => 'polo');
$form->addElement('select', 'nom_val', afficher_message('nomsaisir'), $data, 'onchange="javascript:testjs()"', array('class' => 'Fixe'));
?>
dans le gabarit:
{literal}
<script type="text/javascript">
function testjs(){
var nouveau_mdp="null"
//lecture du nom puis verification
alert(nom);
//faire comme suit, impossible !!! : $form->setDefaults(nouveau_mdp',"null")
}
</script>
{/literal}
|
Merci _________________ /\_ Le forum est là lorsqu'on a besoin d'aide. _/\ |
|
Back to top |
|
ciboulette Smarty Regular
Joined: 13 Jul 2006 Posts: 45
|
|
Back to top |
|
dawei Smarty Rookie
Joined: 14 Dec 2006 Posts: 11
|
Posted: Mon Dec 18, 2006 3:34 pm Post subject: |
|
|
ok, merci l'ami.
c'est bien ca que je recherche mais je vois toujours pas comment gérer l'ajax (j'aimerai trop programmer avec ajax)
J'ai d'un coté une page contenant que du php avec à la fin un appel à mon gabarit html, et d'un autre coté une page html avec des parametres recupéré de la page php.
Merci _________________ /\_ Le forum est là lorsqu'on a besoin d'aide. _/\ |
|
Back to top |
|
ciboulette Smarty Regular
Joined: 13 Jul 2006 Posts: 45
|
|
Back to top |
|
jbenzakin Smarty Rookie
Joined: 09 Nov 2006 Posts: 6 Location: austin
|
|
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
|