I´m stuck with the follow code, hope somebody can help or give me some advice: basically what i´m doing is to call a cf function using ajax: when the user write an id in the field "artid" information related to that id will appear in the others cfinput. the above code works fine.
<cfajaxproxy bind="cfc:portal_dgmu.pruebas.addPerson.test.getData({artid@keyup})" onsuccess="showData">
<script>
function showData(d) {
var data = {}
for(var i=0; i < d.COLUMNS.length; i++) {
data[d.COLUMNS[i]] = d.DATA[0][i]
}
document.getElementById('artname').value = data["ARTNAME"]
document.getElementById('description').value = data["DESCRIPTION"]
document.getElementById('price').value = data["PRIZE"]
}
</script>
<html>
<cfform>
id: <cfinput type="text" name="artid" id="artid"><br/>
nombre: <cfinput type="text" name="artname" id="artname" readonly="true"><br/>
descripcion: <cftextarea name="description" id="description" readonly="true"></cftextarea><br/>
precio: <cfinput type="text" name="price" id="price" readonly="true"><br/>
</cfform>
</html>
i also have the follow code:
<script>
function addFields(){
var number = document.getElementById("member").value;
var container = document.getElementById("container");
while (container.hasChildNodes()) {
container.removeChild(container.lastChild);
}
for (i=0;i<number;i++){
container.appendChild(document.createTextNode(i+1));
var input = document.createElement("input");
input.type = "text";
input.name = "member" + i;
var boton = document.createElement("input");
boton.name = "boton" + i;
container.appendChild(input);
container.appendChild(boton);
container.appendChild(document.createElement("br"));
}
}
</script>
<html>
Enter a number of persons: (max. 10)<input type="text" id="member" size="3" name="member" value="">
<a href="#" id="filldetails" onclick="addFields()">Agregar</a>
<div id="container"/>
</html>
the above code is just adding text fields depending on the number that the user's entered,it also works fine.
My problem is that i just can´t figure out how to integrate both of them, i mean what i need to do is depending on the number that the user types were deployed text fields and the first one must type an id which will bring the data related to that ID.
Thank you so much!!