Bien le bonjour ! Voilà, j'ai un select multiple, et à l'intérieur une listbox que je crée à partir d'un fichier csv. Sur cette listbox, je peux retirer des éléments, les ajouter(si l'élément est retirer), et monter / descendre un élément dans la liste.
Cependant, je cherche à extraire à partir de mon button submit, la liste ENTIERE de tous les éléments, afin de pouvoir ajouter cette liste, dans un autre fichier csv pour comptabiliser les résultats (système de vote).

Quelqu'un aurait-il une idée pour extraire cette liste entière ?

Je vous laisse mon code ici :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
 
echo" <form name=\"export\" action =\"verifVote.php\" method=\"post\" OnSubmit=\"javascript: soumettre_1liste( document.forms[0].choix );\" action=\"export.php\">
				<table summary=\"\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
				  <tr>
					<th style=\"width:  90px;\"></th>
					<th style=\"width: 220px;\"></th>
					<th style=\"width: 150px;\"></th>
					<th style=\"width: 220px;\"></th>
					<th style=\"width:  90px;\"></th>
				  </tr>
				  <tr>
					<td><br /></td>
					<td>Candidats : <br /></td>
					<td><br /></td>
					<td>Vote : <br /></td>
					<td><br /></td>
				  </tr>
				  <tr>
					<td><br /></td>
					<td rowspan=\"7\">
					  <select name=\"dispo[]\" id=\"dispo\" size=10 style=\"width: 210px;\" size=\"16\" OnDblClick=\"javascript: deplacer( this.form.dispo, this.form.choix );\"  multiple>";
						remplirListe();
					echo"  </select><br />
					</td>
					<td><br /></td>
					<td rowspan=\"7\">
					  <select name=\"choix[]\" id=\"choix\" size=10 style=\"width: 210px;\" size=\"16\" OnDblClick=\"javascript: deplacer( this.form.choix, this.form.dispo );\" multiple >
					  </select><br />
					</td>
					<td><br /></td>
				  </tr>
				  <tr>
					<td><br /></td>
					<td><input type=\"button\" value=\"ajouter >\" OnClick=\"javascript: deplacer( this.form.dispo, this.form.choix );\" /><br /></td>
					<td rowspan=\"2\"><input type=\"button\" value=\"Monter\" OnClick=\"javascript: deplacer_hautbas( this.form.choix, -1 );\" /><br /></td>
				  </tr>
				  <tr>
					<td><br /></td>
					<td><input type=\"button\" value=\"ajouter tout >>\" OnClick=\"javascript: deplacer_tout( this.form.dispo, this.form.choix );\" /><br /></td>
				  </tr>
				  <tr>
					<td><br /></td>
					<td><br /></td>
					<td><br /></td>
				  </tr>
				  <tr>
					<td><br /></td>
					<td><input type=\"button\" value=\"< retirer\" OnClick=\"javascript: deplacer( this.form.choix, this.form.dispo );\" /><br /></td>
					<td rowspan=\"2\"><input type=\"button\" value=\"Descendre\" OnClick=\"javascript: deplacer_hautbas( this.form.choix, 1 );\" /><br /></td>
				  </tr>
				  <tr>
					<td><br /></td>
					<td><input type=\"button\" value=\"<< retirer tout\" OnClick=\"javascript: deplacer_tout( this.form.choix, this.form.dispo );\" /><br /></td>
				  </tr>
				  <tr>
					<td><br /></td>
					<td><br /></td>
					<td><br /></td>
				  </tr>
				</table>
				<br />
				<input type=\"submit\" value=\"OK\";/> <input type=\"button\" value=\"Annuler\" OnClick=\"javascript: deplacer_tout( this.form.choix, this.form.dispo );\"/><input type=\"submit\" value =\"Vote Blanc\"><br />
			</form>";
		}
Et je vous laisse mes fonctions javascript que j'avais utilisé :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 
function deplacer( liste_depart, liste_arrivee )
		{
			for( i = 0; i < liste_depart.options.length; i++ )
			{
				if( liste_depart.options[i].selected && liste_depart.options[i] != \"\" )
				{
					o = new Option( liste_depart.options[i].text, liste_depart.options[i].value );
					liste_arrivee.options[liste_arrivee.options.length] = o;
					liste_depart.options[i] = null;
					i = i - 1 ;
				}
			}
	  }
		function deplacer_tout( liste_depart, liste_arrivee )
		{
		for( i = 0; i < liste_depart.options.length; i++ )
		{
		  o = new Option( liste_depart.options[i].text, liste_depart.options[i].value );
		  liste_arrivee.options[liste_arrivee.options.length] = o;
		  liste_depart.options[i] = null;
		  i = i - 1 ;
		}
	  }
	  function deplacer_hautbas( liste, sens )
	  {
 
		var listemax = liste.length - 2;
		var listesel = liste.selectedIndex;
 
		if( ( listesel < 0 ) || ( listesel < 1 && sens == -1 ) || ( listesel > listemax && sens == 1 ) )
		{
		  return false;
		}
		tmpopt = new Option( liste.options[listesel+sens].text, liste.options[listesel+sens].value );
		liste.options[listesel+sens].text = liste.options[listesel].text;
		liste.options[listesel+sens].value = liste.options[listesel].value;
		liste.options[listesel+sens].selected = true;
		liste.options[listesel].text = tmpopt.text;
		liste.options[listesel].value = tmpopt.value;
		liste.options[listesel].selected = false;
		return true;
	  }
 
	  function soumettre_1liste( liste )
	  {
		var listelen = liste.length;
		for( i = 0; i < listelen; i++ )
		{
		  liste.options[i].selected = true;
		}
	  }