By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,187 Members | 1,630 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,187 IT Pros & Developers. It's quick & easy.

Retreiving values of form elements after being changed by DOM

P: n/a
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?

Jul 14 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.

Jul 14 '06 #2

P: n/a
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>
<table width="50%" border="1" cellpadding="0" cellspacing="0"
bordercolor="#CCCCCC" id="myTable" name="myTable">
<tr id="1">
<td <input name="radiobutton" type="radio"
value="radiobutton">1 </td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr id="1">
<td width="11%">&nbsp;</td>
<td width="28%"><input type="checkbox" name="checkbox"
value="checkbox1" >Checkbox 1 </td>
<td width="28%">&nbsp;</td>
</tr>
<tr id="2">
<td><input name="radiobutton" type="radio"
value="radiobutton">2</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr id="2">
<td width="11%">&nbsp;</td>
<td width="28%"><input type="checkbox" name="checkbox"
value="checkbox2">Checkbox 2 </td>
<td width="28%">&nbsp;</td>
</tr>
</table>
</form>

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"

Hope I make sense!

Jul 15 '06 #3

P: n/a
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>&nbsp;</td>
<td>&nbsp;</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>&nbsp;</td>
<td>&nbsp;</td>
</tr><tr>
<td>&nbsp;</td>
<td><input type="checkbox" name="checkbox"
value="checkbox1" >Checkbox 1 </td>
<td>&nbsp;</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
Jul 15 '06 #4

P: n/a

RobG wrote:
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>&nbsp;</td>
<td>&nbsp;</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>&nbsp;</td>
<td>&nbsp;</td>
</tr><tr>
<td>&nbsp;</td>
<td><input type="checkbox" name="checkbox"
value="checkbox1" >Checkbox 1 </td>
<td>&nbsp;</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

Thanks for all the help Rob

Regards,
Angel

Jul 17 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.