Hi,
I have 2 chronoform forms :
and
The first form call the second form. In the second form i use a javascript fonction who need to use the nomuser value but nomuser is always not found.
The hmtl code of the second form is :
the js part is (voluntary reduced) :
The beginning of the html code display nomuser correctly, but my ajouter_activite js function doesn't display the good value when i click the ajouter_button. Where is the problem ?
I have 2 chronoform forms :
http://localhost/altair/index.php?option=com_chronocontact&chronoformname=inscription_utilisateur_etape1and
http://localhost/altair/index.php?option=com_chronocontact&chronoformname=inscription_utilisateur_etape2&nomuser=nomuserThe first form call the second form. In the second form i use a javascript fonction who need to use the nomuser value but nomuser is always not found.
The hmtl code of the second form is :
<?php $nomutilisateur = $_GET['nomutilisateur'];
echo $nomutilisateur;
?>
<h1>Vos activités</h1>
<label>Type :</label>
<select name='auteur' id='auteur' onchange='affichage_categorie()'>
<option value='-1'>Choisir un type</option>
<?php
$res = mysql_query("SELECT * FROM jos_comprofiler_field_values WHERE fieldid=54 ORDER BY fieldtitle");
while($row = mysql_fetch_assoc($res)){
echo "<option value='".$row["fieldvalueid"]."'>".$row["fieldtitle"]."</option>";
}
?>
</select>
<br/>
<label>Categorie :</label>
<div id='categorie' style='display:inline'>
<select name='categorie'> <option value='-1'>Choisir une categorie</option> </select>
</div>
<br/>
<label>Activite :</label>
<div id='activite' style='display:inline'>
<select name='activite'> <option value='-1'>Choisir une activite</option> </select>
</div>
<br/>
<label>Niveau :</label>
<div id='niveau' style='display:inline'>
<select name='niveau'> <option value='-1'>Choisir un niveau</option></select>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Ajouter" name="button_ajouter" type="button" OnClick="ajouter_activite()"; />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_element cf_button">
<input value="Supprimer" name="button_supprimer" type="button" OnClick="supprimer_activite()"; />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="S'inscrire" name="button_inscription" type="button" OnClick="valider_inscription()";/>
</div>
</div>the js part is (voluntary reduced) :
function ajouter_activite(){
<?php $nomutilisateur = $_GET['nomutilisateur'];?>
var v = <?php echo $nomutilisateur; ?>;
alert (v);
The beginning of the html code display nomuser correctly, but my ajouter_activite js function doesn't display the good value when i click the ajouter_button. Where is the problem ?
Well, in finally found a "generic solution" to retrieve this value :
Whith this code you can retrieve values posted in URL and use it in your js code. I hope that it will help someone one day ... :-)
<script type="text/javascript">
var nom=new Array();
var valeur=new Array();
// On enlève le ?
param = window.location.search.slice(1,window.location.search.length);
// On sépare le paramètres....
// first[0] est de la forme param=valeur
first = param.split("&");
for(i=0;i<first.length;i++){
second = first[i].split("=");
nom[i] = second[0];
valeur[i] = second[1];
}
</script>
Whith this code you can retrieve values posted in URL and use it in your js code. I hope that it will help someone one day ... :-)
This topic is locked and no more replies can be posted.
