C
cogitoergosum
Hi,
I have a table with four columns.
By default, except for the second column (id="s01") all column values
are protected. When a value is selected from second column, the third
column is enabled. When a value is selected in the third column, the
fourth column is enabled and a separate button for adding a new row
(as in <tr> of code snippet above) is also enabled.
As you would have guessed, I have got the javascript code working when
number of rows is one.
This is obviously because, the javascript for en/disablement does not
get to know which cell was selected.
Thus, if there are four rows and I selected a value from the second
column (id="s02"), how do I detect which cell was selected and thereby
take the action in the adjacent cell ?
<table id="t01" cellpadding="1" cellspacing="0">
<tr>
<td align=center>Delete</td>
<td align=center>Item type</td>
<td align=center>Month Ending</td>
<td align=center>Comments</td>
</tr>
<tr><td><input type="checkbox" id="c01" disabled="true"></td>
<td><select id="s01" value="0">
<option id="00" value="0">Select item type...</option>
<option id="01" value="1">Vendor Item</option>
<option id="02" value="2">Wholesale Item</option>
<option id="03" value="3">Distributor Item</option>
</select></td>
<td><select id="s02" disabled="true" value="0">
<option id="00" value="0">Month ending...</option>
<option id="01" value="1">Jan</option>
<option id="02" value="2">Feb</option>
<option id="03" value="3">Mar</option>
</select></td>
<td><input type="text" id="desc" size="80" accept="plain/text"
disabled="true"></input></td>
</tr>
</table>
Thanks,
Nagesh
PS: I did search this forum. But, most code samples pointed to getting
to a cell from the javascript code rather than the other way around.
I have a table with four columns.
By default, except for the second column (id="s01") all column values
are protected. When a value is selected from second column, the third
column is enabled. When a value is selected in the third column, the
fourth column is enabled and a separate button for adding a new row
(as in <tr> of code snippet above) is also enabled.
As you would have guessed, I have got the javascript code working when
number of rows is one.
This is obviously because, the javascript for en/disablement does not
get to know which cell was selected.
Thus, if there are four rows and I selected a value from the second
column (id="s02"), how do I detect which cell was selected and thereby
take the action in the adjacent cell ?
<table id="t01" cellpadding="1" cellspacing="0">
<tr>
<td align=center>Delete</td>
<td align=center>Item type</td>
<td align=center>Month Ending</td>
<td align=center>Comments</td>
</tr>
<tr><td><input type="checkbox" id="c01" disabled="true"></td>
<td><select id="s01" value="0">
<option id="00" value="0">Select item type...</option>
<option id="01" value="1">Vendor Item</option>
<option id="02" value="2">Wholesale Item</option>
<option id="03" value="3">Distributor Item</option>
</select></td>
<td><select id="s02" disabled="true" value="0">
<option id="00" value="0">Month ending...</option>
<option id="01" value="1">Jan</option>
<option id="02" value="2">Feb</option>
<option id="03" value="3">Mar</option>
</select></td>
<td><input type="text" id="desc" size="80" accept="plain/text"
disabled="true"></input></td>
</tr>
</table>
Thanks,
Nagesh
PS: I did search this forum. But, most code samples pointed to getting
to a cell from the javascript code rather than the other way around.