Dynamic checkbox ignored when posting

Discussion in 'Javascript' started by Mark, Jan 16, 2004.

  1. Mark

    Mark Guest

    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!
     
    Mark, Jan 16, 2004
    #1
    1. Advertising

  2. Mark

    lallous Guest

    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" <> wrote in message
    news:40079529$0$70305$...
    > 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!
     
    lallous, Jan 16, 2004
    #2
    1. Advertising

  3. Mark

    kaeli Guest

    In article <40079529$0$70305$>,
    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/domref/dom_el_ref.html#1021544


    --
    --
    ~kaeli~
    If you drink, don't park. Accidents cause people.
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
     
    kaeli, Jan 16, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. alanb
    Replies:
    2
    Views:
    542
    alanb
    Apr 23, 2004
  2. Ryan Ternier
    Replies:
    7
    Views:
    6,435
    S. Justin Gengo
    Oct 22, 2005
  3. AmitKu
    Replies:
    7
    Views:
    522
    John Timney \(MVP\)
    Jan 8, 2007
  4. pizzy
    Replies:
    0
    Views:
    169
    pizzy
    Mar 23, 2005
  5. pizzy
    Replies:
    5
    Views:
    387
    pizzy
    Apr 12, 2005
Loading...

Share This Page