Angel wrote:
Richard Cornford wrote:
>Angel wrote:
>>I have an html form with checkboxes in different rows. The
functionality is that of changing the position of the checkboxes
through DOM.
When I try to save the form after the changes, firefox doesnt
recognize the checkbox element whose position was changed.
How do i retrieve the value of the checkbox whose position was
changed?
Generally Firefox functions near flawlessly so without a demonstration
of the code that you are having trouble with there will not be a great
deal that anyone can say towards resolving any issues it provokes.
Richard.
Consider the following table
<form>
The action attribute is required.
<table width="50%" border="1" cellpadding="0" cellspacing="0"
bordercolor="#CCCCCC" id="myTable" name="myTable">
Table's don't have either a bordercolor or name attribute: bordercolor
does not belong to HTML 4 at all.
<tr id="1">
The id attribute must start with a letter, not a number - though I think
most browsers will tolerate numbers it isn't valid markup.
<td <input name="radiobutton" type="radio"
value="radiobutton">1 </td>
<td> </td>
<td> </td>
</tr>
<tr id="1">
The id attribute must be unique within a document, using getElementById
will likely always return the first element with the duplicate id.
You may find your problem related to the above.
[...]
On click of checkbox2 i write a function to move its position in the td
next to checkbox1
After doing so, i call the following function :
function myFunc()
{
var v = document.forms[0].elements['checkbox'];
for(i=0; i<v.length; i++)
alert(v[i].value);
}
Firefox doesnt alert "checkbox2"
It does for me. Try:
<script type="text/javascript">
function moveMe(el)
{
var tBody = el.parentNode.parentNode.parentNode;
var td = tBody.rows[1].cells[2];
td.appendChild(el);
myFunc();
}
function myFunc()
{
var v = document.forms[0].elements['checkbox'];
for(i=0; i<v.length; i++)
alert(v[i].value);
}
</script>
<form action="">
<table border="1" id="myTable">
<tr>
<td><input name="radiobutton" type="radio"
value="radiobutton">1</td>
<td> </td>
<td> </td>
</tr><tr>
<td> </td>
<td><input type="checkbox" name="checkbox"
value="checkbox1" >Checkbox 1 </td>
<td> </td>
</tr><tr>
<td><input name="radiobutton" type="radio"
value="radiobutton">2</td>
<td></td>
<td></td>
</tr><tr>
<td></td>
<td><input type="checkbox" name="checkbox"
value="checkbox2"
onclick="moveMe(this);"
>Checkbox 2 </td>
<td></td>
</tr>
</table>
</form>
--
Rob