how can I get the data from an ajax created textfield

Do all of the text fields have a unique value for name="whatever" ? I've had problems with my field names not getting created correctly. Also, do you really need to use AJAX? You could probably just use client-side javascript for creating blank text fields.

Here is the javascript I use to insert a pair of text fields. I'm not sure it's the best way, but it's woked well so far. The only requirement is that you have this: <input id="counter" type="hidden" value="0" /> In your page. This is good, because it allows me to set the value of counter if I'm editing an object that already has some of these fields. Then I can start the generated fields at 12 or 20 or whatever.

Hope this helps! Jason

Code:

var counter = 0;

function addField() {     if(counter == 0) {         counter = parseInt(document.getElementById("counter").value);         }     //Get the container Element.     var containerDiv = document.getElementById("fields");       //Set the name for the new input     var inputIdName = "attribute_" + counter;        //Create the DIV     var newInput = document.createElement("div");        //Name the DIV     newInput.setAttribute("id",inputIdName);        //Put the HTML we want into a variable     var insertHTML = '<table style="margin-left: 30px;" >\n<tr>' +             '<td>Name: <input type="text" name="attribute[' + counter + ']" size="30" /></td>' +             '<td>Value: <input name="value[' + counter + ']" type="text" size="60"/>' +             '</td></tr></table>';        //Put the HTML into our div newInput.innerHTML = insertHTML;     containerDiv.appendChild(newInput);        //Increment the counter     counter = counter + 1; }

sayoyo wrote: