Bonjour à tous,
Je programme présentement une gestion de questionnaire sur le web. J'ai donc fait cela dynamique (on clique sur un plus ajouter question/réponse). Mon problème est donc le suivant : après le POST je ne reçois pas les input créer dynamiquement. Je ne comprends vraiment pas! Voici quelques bouts de mon code.
Cette table est dans une balise form qui a comme ID 'theform'.
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 <table style='border:1px solid black;' id="question1" cellspacing="0" cellpadding="0"> <tr id="questionRow1"> <td width="80px" style="text-align:right"><label for="question">Question :</label></td> <td width="80px" style="text-align:right"><input type="text" name="questionInput1" id="questionInput1"><input type="hidden" name="nbQuestion1" id="nbQuestion1" value="1"></td> <td width="16px"><img src="../img/add.png" onclick="addChoix(1);"></td> <td width="16px"><img src="../img/del.png" onclick="delQuestion(this.parentNode.parentNode.parentNode.parentNode.id);"></td> </tr> <tr id="answerRow1_1"> <td width="80px" style="text-align:right"> Choix:</td> <td width="80px" style="text-align:right"><input type="text" name="answerInput1-1" id="answerInput1-1"></td> <td width="16px"> </td> <td width="16px"><img src="../img/del.png" onclick="delChoix(this.parentNode.parentNode.id);"></td> </tr> </table>
Merci beaucoup de votre aide.
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 addChoix(o) { questionAnswer[o] = questionAnswer[o]+1; var idd = o+'_'+questionAnswer[o]; var a = "answerRow"+idd; html2 = "<tr id='answerRow"+idd+"'>"; html2 += '<td width="80px" style="text-align:right"> Choix:</td>'; html2 += '<td width="80px"><input type="text" name="answerInput'+o+'-'+questionAnswer[o]+'" id="answerInput'+o+'-'+questionAnswer[o]+'"></td>'; html2 += '<td width="16px"> </td>'; html2 += "<td width='16px'><img src='../img/del.png' onclick='delChoix(this.parentNode.parentNode.id);'></td>"; html2 += "</tr>"; $('#question'+o).append(html2); $('#theform').append(html2); $('#nbQuestion'+o).val(questionAnswer[o]); }
Partager