473,396 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Retreiving values of form elements after being changed by DOM

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
4 1459
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
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
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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Randell D. | last post by:
HELP! I am determined to stick with this... I'm getting there... for those who haven't read my earlier posts, I'm createing what should be a simple function that I can call to check that...
6
by: Amir Hardon | last post by:
I'm new to DOM and can't figure out this thing: I'm trying to add a row to a table with a form field in one of it's cells, but if I'm appending the field to a form it gets out of the table. Can...
15
by: crjunk | last post by:
I have 4 TextBoxes on my form that I'm trying to add together to get a grand total. Here is the code I'm using: <SCRIPT LANGUAGE="JavaScript"> <!-- Beginning of JavaScript - function...
6
by: Tyrone Slothrop | last post by:
I am coding a search form which carries the values to an identical form on the search results page. A "Clear Fields" button to remove the values from the previous search is required. Ideally I...
3
by: awebguynow | last post by:
in other words, Can I make client side mod's before I submit a form and Post ? I guess its just a matter of cycling through the form elements and setting value to null (or empty string) for...
29
by: Amer Neely | last post by:
I've got a dynamically built form with checkboxes for each element ( a list of file names in a directory). I need to grab only those checkboxes that are checked, so I can then delete those files. ...
17
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I get the value of a form control? -----------------------------------------------------------------------...
4
by: Chronictank | last post by:
Hi, as a bit of background (and seeing as it is my first post :)) i am a complete newbie at perl. I literally picked it up a week ago to do this project as it seemed like the best choice for a...
5
by: Rider | last post by:
Hi All, Here is the reason why i ak asking for ur help. I have a edit form in which the values already stored in DB are populated. User can edit some or all the values in the form. then he...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.