Bonjour à tous,
je commence dans le javascript et j'utilise le JQuery pour dynamiser mes formulaire (filtrage de catégorie sans recharger la page).
Mon programme php fonctionne sans javascript donc ce n'est pas une erreur dans le php.
Mon problème est le suivant:
Je n'arrive pas à récupérer des valeurs de retour (POST) d'un formulaire dans firefox après l'appel à ma fonction javascript.
Sous IE cela fonctionne.
Voici ce que donne un print_r de $_POST sous IE
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Array ( [wording_FR_82299] => Certification Volkswagen [wording_NL_82299] => Certificatie Volkswagen [session_exam_82299] => 1 [active_82299] => Y [nbr_question_heading_3_82299] => 36 [nbr_question_heading_1_82299] => 40 [nbr_examen_82299] => 1 [nbr_heading_max] => 2 [valid] => Valider [idSub] => 82299 )
Tandis que sous firefox j'ai:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
Array ( [wording_FR_31991] => Certification Volkswagen [wording_NL_31991] => Certificatie Volkswagen [valid] => Valider [idSub] => 31991 )
Notice: Undefined index: session_exam_31991 in C:\wamp\www\limesurvey\admin\administration_DB.php on line 1101
 
Notice: Undefined index: session_exam_31991 in C:\wamp\www\limesurvey\admin\administration_DB.php on line 1146
 
Notice: Undefined index: active_31991 in C:\wamp\www\limesurvey\admin\administration_DB.php on line 1147
 
Notice: Undefined index: session_exam_31991 in C:\wamp\www\limesurvey\admin\administration_DB.php on line 1715
 
Notice: Undefined variable: tabUserFull in C:\wamp\www\limesurvey\admin\administration_DB.php on line 1756
 
Notice: Undefined index: active_31991 in C:\wamp\www\limesurvey\admin\administration_DB.php on line 1761
Voici ma fonction javascript:
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
function send_post_value_select(test,url,add_var)
{
$.ajax
(
{
type: "POST",
url: url,
data: "var="+test.value+"&add_var="+add_var,
success: function(msg){
	$("#ajax_action").empty();
	$("#ajax_action").append(msg);
	}
});
$("#ajax_action").show();
}
Je l'appelle en fesant un onchange=... dans mon submit.
L'injection html fonctionne bien mais je ne sais pas pourquoi firefox refuse de prendre mon changement dans le td id='ajax_action'
Je vous mets l'html de sortie après changement par la fonction javascript dans firefox:
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<table id="tabPrint">
			<tr>
				<a href='administration_DB.php?action=examen'>
					<img height='20px' src='http://localhost/limesurvey/docLimeSurvey/img/action_back.png' alt='' title='Retourner sur la page précédente' />Retour
				</a>
				<form onsubmit="loading_page();" action="administration_DB.php?action=examen&amp;subaction=new&amp;idSub=15988&amp;form=1" method="POST"></form>
				<th>Id d'examen</th>
				<th>Titre FR d'examen</th>
				<th>Titre NL d'examen</th>
			</tr>
			<tr>
				<td>15988</td>
				<td>
					<input type="text" name="wording_FR_15988" value="Certification Volkswagen" maxlength="200" size="80">
				</td>
				<td>
					<input type="text" name="wording_NL_15988" value="Certificatie Volkswagen" maxlength="200" size="80">
				</td>
			</tr>
			<tr>
				<td colspan="4" class="error">Choississez une session avant tout autre chose et valider !! (permet de filtrer les rubriques)</td>
			</tr>
			<tr>
				<td id="ajax_action" colspan="3">
					<table id="tabPrint">
							<tr>
								<th>Session à lier</th>
								<th>Activer</th>
								<th>Date de création</th>
							</tr>
							<tr>
								<td>
									<select onchange="send_post_value_select(this,'ajax_action_session_exam.php','15988');" name="session_exam_15988" id="session_exam_15988">
										<option selected="" value="1">1 - Session Vw Full user/question</option>
										<option value="2">2 - Session Audi Full user/questio</option>
										<option value="3">3 - Session Skôda Full u/q</option>
										<option value="4">4 - Session Porsche Full u/q</option>
										<option value="5">5 - Session Vente Vw</option>
									</select>
								</td><td>
									<select name="active_15988">
										<option value="Y">Oui</option>
										<option value="N">Non</option>
									</select>
								</td>
								<td>2010-12-08</td>
							</tr>
							<tr>
								<td></td>
								<td colspan="2">Spécifique Vw (max: 36): 
									<input type="text" name="nbr_question_heading_3_15988" value="36" size="5">
								</td>
							</tr>
							<tr>
								<td></td>
								<td colspan="2">Techniques de vente (max: 40): 
									<input type="text" name="nbr_question_heading_1_15988" value="40" size="5">
								</td>
							</tr>
							<tr>
								<td colspan="2">Nombre d'examens: 
									<input type="text" name="nbr_examen_15988" value="1" size="5">
								</td>
								<td></td>
							</tr>
							<input type="hidden" name="nbr_heading_max" value="2">
					</table>
				</td>
			</tr><tr>
				<td>
					<input type="submit" name="valid" value="Valider"><input type="hidden" name="idSub" value="15988">
				</td>
			</tr>
			<tr></tr>
			<tr>
				<td>
					<a href="administration_DB.php?action=examen">
						<img height="20px" title="Retourner sur la page précédente" alt="" src="http://localhost/limesurvey/docLimeSurvey/img/action_back.png">
						Retour
					</a>
				</td>
			</tr>
		</form>
</table>
Exactement la même chose du côté IE que Firefox mais il ne passe pas les valeurs POST dans firefox si je l'ai injecté avec du javascript