Getting input values from innerHTML

On the web…

I have a form with a list of items. When an item is selected (checkbox) I am writing HTML (using ajax) to a notes table (via the ID tag on the table cells HTML properties). The html contains columns with imput fields for the user to enter qty, price, etc.

When I access the table cell through document.forms[0].getElementById(“myid”) I get nothing. Only when I use document.forms[0].getElementById(“myid”).innerHTML do I get the HTML that was originally written to that ID. It is ugly byt I can parse out the html to get what I want for the “computed” columns such as the item name, but for the columns where I have an input field, anything entered into that field does not show up when I grab that ID’s innerHTML using javascript.

Any thoughts? The goal is to display a row (item, price, qty) for each item selected, when that item is selected, and without a page reload.

Any suggestions would be helpful.

Thanks!

Shean McManus

Subject: Getting input values from innerHTML

Well, exactly what were you expecting? The value entered into an input item does not affect the HTML it takes to display the item.

(By the way, getElementById() is a method of the document object, not of the form. I have to think you’re testing in Internet Explorer – document.forms[0].getElementById(“X”) wouldn’t work in a fussier browser. It should be document.getElementById(“X”).)

If you are looking for a field value, then look for a field value:

document.forms[0].elements[“FieldNameHere”].value

or

document.getElementById(“CellID”).getElementsByTagName(“input”)[0].value