Jump to content

input tag mystery


george

Recommended Posts

I have a form which auto populates with values when one selects a city from a list. The onchange event of the select control calls a javascript function which uses AJAX to pass a query to a php script which returns an XML which is picked up by another javascript function which calls a series of

document.getElementById('POC_City').value = xmlDoc.getElementsByTagName("POC_City")[0].childNodes[0].nodeValue;

which populate the other fields in the form. But some of them weren't populating.

<td><input type="text" name="POC_City" id="POC_City" size="25" maxlength="50" tabindex="31" /></td>

untill I added a name attribute which contained the same content as the id. Why did this make it work? I am beginning to think I do not know my name from my id, or my browser doesn't. Why does this not work just using the id?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...