Hey,

I got this setup going on where the user can add multiple autocomplete
boxes onto the page. I got a problem though, I need to return the ID
of the selected user so I can use it with the PHP backend, but when a
new row is made, all the ID values are changed to the latest
autocomplete field.

Does anyone know any way around this?

=== START ===

        function addFormField() {

         var id = document.getElementById("id").value;

         $("#lesson-student-array").append("<tr id='row" + id + "'><td
style='width:16px;'><p>" + id + "</p></td><td style='width:
160px;'><p><input id='example' class='auto-student-name' /><input
id='value' /></p></td><td style='width:16px;'><a href='#'
onClick='removeFormField(\"#row" + id + "\"); return false;'><img
src='/style/icons/delete.png' alt='' /></a></td></tr>");




$(".auto-student-name").autocomplete("/manage/users/autoname-
conduit.php").result(function (event, data, formatted) {

$("#value").val(data[1]);
});


         id = (id - 1) + 2;
         document.getElementById("id").value = id;
        }

=== END ===

Reply via email to