Bionicman: AJAX Formularfelder auswerten

Beitrag lesen

Hallo Bionicman,

also bei mir geht das, sowohl das dynamische Erzeugen von Inputfeldern, als auch das Anzeigen des so erzeugten Queltextes. Vieleicht zeigst du uns mal etwas Code oder einen Link auf deine Seite, damit wir nicht so in Blaue raten müssen.

Gruß, Jürgen

»»

Im wesentlichen sind das die Teile:
Klappt auch wunderbar, nur kann die Felder wenn sie erzeugt wurden, nicht ansprechen :(

Die JS Funktion:

function add_contact()
{
 var new_tr = document.createElement("tr");
 var new_td = document.createElement("td");
 new_td.setAttribute("height","20");
 new_tr.appendChild( new_td );
 document.getElementById("contacts").appendChild( new_tr );

var new_tr = document.createElement("tr");
 var new_td = document.createElement("td");

new_td.innerHTML = 'Name:<br /><input type="text" name="names[]" size="60"><br />Tel:<br /><input type="text" name="tel[]" size="60"><br />Mail:<br /><input type="text" name="mail[]" size="60">';

new_tr.appendChild( new_td );
 document.getElementById("contacts").appendChild( new_tr );

}

Die html-Seite:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>etwas</title>
</head>

<body>

<table width="100%" cellpadding="0" cellspacing="0">
<form name="info_form" action="#" method="post" onsubmit="sendRequest(this)">

<tr><td>
   <table class="text" bgcolor="#f2f2f2" width="100%" cellpadding="0" cellspacing="0">
<tr>
     <td class="text">Kontakt/e:</td>
     <td>
            <table id="contacts" cellpadding="0" cellspacing="0">
            <tr>
            <td>Name:<br /><input type="text" name="names[]" size="60"><br />Tel:<br /><input type="text" name="tel[]" size="60"><br />Mail:<br /><input type="text" name="mail[]" size="60"></td>
            </tr>
            </table>
            </td>
     </tr>

</table>
</td></tr>
</form>
</table>

</body>
</html>