469,336 Members | 5,248 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

Dynamic checkbox ignored when posting

Hi - when I add (dynamically) a row to a table, which includes a
checkbox, I want the value of the checkbox to be posted along with the
other controls already on the form when the form is submitted.

I can get this to work no problem on IE6, but in NN7, although the
checkbox is added to my screen, when posted (submit on form), the
checkbox is ignored. The checkbox is added within the form.

Any ideas?

function addRowaddFact (cb_strval) {
var table;
table = document.getElementById('tbladdFact');
if (table && table.insertRow) {
var row = table.insertRow(table.rows.length);
var cell = row.insertCell(0);

cell.innerHTML = '<input checked
type="checkbox" name="cbaddFact" value="' + cb_strval +
'"\/>'+cb_strval;
}
}

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
2 1234
Hello,

Are the checkboxes being added to the form being posted?

If they still don't get posted, try to change the posting mechanism...use a
hidden variable that will encode all the needed values whenever you post the
form, then the server page will read its info from this hidden field instead
of the checkboxes.

--
Elias
"Mark" <an*******@devdex.com> wrote in message
news:40***********************@news.frii.net...
Hi - when I add (dynamically) a row to a table, which includes a
checkbox, I want the value of the checkbox to be posted along with the
other controls already on the form when the form is submitted.

I can get this to work no problem on IE6, but in NN7, although the
checkbox is added to my screen, when posted (submit on form), the
checkbox is ignored. The checkbox is added within the form.

Any ideas?

function addRowaddFact (cb_strval) {
var table;
table = document.getElementById('tbladdFact');
if (table && table.insertRow) {
var row = table.insertRow(table.rows.length);
var cell = row.insertCell(0);

cell.innerHTML = '<input checked
type="checkbox" name="cbaddFact" value="' + cb_strval +
'"\/>'+cb_strval;
}
}

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 20 '05 #2
In article <40***********************@news.frii.net>,
an*******@devdex.com enlightened us with...
Hi - when I add (dynamically) a row to a table, which includes a
checkbox, I want the value of the checkbox to be posted along with the
other controls already on the form when the form is submitted.

I can get this to work no problem on IE6, but in NN7, although the
checkbox is added to my screen, when posted (submit on form), the
checkbox is ignored. The checkbox is added within the form.


I don't think NN likes the innerHTML.
Use createElement, appendChild and real DOM methods.
http://www.mozilla.org/docs/dom/domr...f.html#1021544
--
--
~kaeli~
If you drink, don't park. Accidents cause people.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Leo J. Hart IV | last post: by
5 posts views Thread by Irfan Akram | last post: by
12 posts views Thread by scottrm | last post: by
34 posts views Thread by clinttoris | last post: by
3 posts views Thread by Raymond | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.