formulaire generé par innerhtml aucun affichage
salut,
Situation:j'au un code javascript qui lance une page php grace a innerhtml et me l'affiche dans un div de ma page. cette page php est constutuée d'un formulaire html qui contient des information recuperer d'un base sql server.
Probleme: je n'arrive pas a afficher mon formulaire dans mon div enfin presque...je m'explique. quand je suprimme les balise d'ouverture et de fermeture du formulaire (<form....> et </form>) mon tableau contenant mes input d'affiche correctement. par contre quand je remet mes balise form et bien la plus rien je ne comprend pas d'ou peu venir ce probleme.
le code js qui ecrit dans ma div:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
var xhr_object = null;
if(window.XMLHttpRequest) xhr_object = new XMLHttpRequest();
else
if (window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
// On ouvre la requete vers la page désirée
var url = "../Vue/formulaire_consultation_action.php?contact_action="+contact;
xhr_object.open("GET", url, true);
xhr_object.onreadystatechange = function(){
if ( xhr_object.readyState == 4 )
{
// j'affiche dans la DIV spécifiées le contenu retourné par le fichier
document.getElementById(affiche).innerHTML = xhr_object.responseText;
}
}
// dans le cas du get
xhr_object.send(null); |
Mon formulaire:
Code:
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 85 86 87
|
echo'
<form method="POST" action="../controleur/controleur_consultation_action.php?Entreprise='.$id_entreprise.'&Contact='.$id_contact.'" name="formulaire_consultation_action">
<div class="form2">
<table border="0">';
//Dans le cas de figure la demande se fait à partir de la consultation entreprise(recup de l'id_entreprise)
if(!empty($_GET['Entreprise'])){
echo '<tr>
<th>Entreprise </th>
<th>Date </th>
</tr>
<tr>
<td>';
include('../connection_bd.php');
$sql = "SELECT [NOMENTREPRISE]
FROM [BDD_TOOL_V2].[dbo].[ENTREPRISE]
WHERE [ID_ENTREPRISE] = '".$id_entreprise."'";
$resultat = odbc_do($connexion, $sql) or die(odbc_error());
while ($row = odbc_fetch_array($resultat)){
$nom_entreprise = $row['NOMENTREPRISE'];
}
odbc_close($connexion);
echo'<label>'.$nom_entreprise.'</label>
</td>
<td>
<SELECT name="Action">';
/*---------- On récuppère les id_action et les date action en fonction de l'entreprise
déjà présent dans la base de donnée pour les afficher si le ---------*/
include('../connection_bd.php');
$sql = "SELECT DISTINCT CONVERT(varchar, ACTIONS.[DATEACTION], 105) date FROM ([BDD_TOOL_V2].[dbo].[ENTREPRISE]
join [BDD_TOOL_V2].[dbo].[CONTACTS] on ENTREPRISE.[ID_ENTREPRISE] = CONTACTS.[ID_ENTREPRISE])
join [BDD_TOOL_V2].[dbo].[ACTIONS] on CONTACTS.[ID_CONTACT] = ACTIONS.[ID_CONTACT]
WHERE ENTREPRISE.[ID_ENTREPRISE] = '".$id_entreprise."'";
$resultat = odbc_do($connexion, $sql) or die(odbc_error());
while ($row = odbc_fetch_array($resultat)){
$date_action = $row['date'];
echo "<option value='".$date_action."'>'".$date_action."'</option>";
}
odbc_close($connexion);
echo'
</td>';
}
//Dans le cas de figure la demande se fait à partir de la consultation contact(recup de l'id_contact)
else{
echo'<tr>
<th>Contact </th>
<th>Date </th>
</tr>
<tr>
<td>';
include('../connection_bd.php');
$sql = "SELECT [NOMCONTACT]
FROM [BDD_TOOL_V2].[dbo].[CONTACTS]
WHERE [ID_CONTACT] = '".$id_contact."'";
$resultat = odbc_do($connexion, $sql) or die(odbc_error());
while ($row = odbc_fetch_array($resultat)){
$nom_contact = $row['NOMCONTACT'];
}
odbc_close($connexion);
echo'<label>'.$nom_contact.'</label>
</td>
<td>
<SELECT name="Action">';
/*---------- On récuppère les id_action et les date action en fonction de l'id contact
déjà présent dans la base de donnée pour les afficher si le ---------*/
include('../connection_bd.php');
$sql = "SELECT DISTINCT CONVERT(varchar, ACTIONS.[DATEACTION], 105) as date
FROM [BDD_TOOL_V2].[dbo].[CONTACTS] JOIN [BDD_TOOL_V2].[dbo].[ACTIONS] ON CONTACTS.[ID_CONTACT] = ACTIONS.[ID_CONTACT]
WHERE CONTACTS.[ID_CONTACT] = '".$id_contact."'";
$resultat = odbc_do($connexion, $sql) or die(odbc_error());
while ($row = odbc_fetch_array($resultat)){
$date_action = $row['date'];
echo "<option value='".$date_action."'>'".$date_action."'</option>";
}
odbc_close($connexion);
echo'
</td>';
}
echo'
<td><input type="image" src="../img/validate.png" alt="Valider"></td>
</tr>
</table>
</div>
</form>
'; |
je me rend fou depuis ce matin et je n'arrive pas a affiher ce formulaire donc si quelqu'un à une idée a me proposer je suis tres preneur merci a vous