Dynamic checkbox ignored when posting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    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.getEle mentById('tblad dFact');
    if (table && table.insertRow ) {
    var row = table.insertRow (table.rows.len gth);
    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

    #2
    Re: Dynamic checkbox ignored when posting

    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" <anonymous@devd ex.com> wrote in message
    news:40079529$0 $70305$75868355 @news.frii.net. ..[color=blue]
    > 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.getEle mentById('tblad dFact');
    > if (table && table.insertRow ) {
    > var row = table.insertRow (table.rows.len gth);
    > 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![/color]


    Comment

    • kaeli

      #3
      Re: Dynamic checkbox ignored when posting

      In article <40079529$0$703 05$75868355@new s.frii.net>,
      anonymous@devde x.com enlightened us with...[color=blue]
      > 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.
      >[/color]

      I don't think NN likes the innerHTML.
      Use createElement, appendChild and real DOM methods.
      The MDN Web Docs site provides information about Open Web technologies including HTML, CSS, and APIs for both Web sites and progressive web apps.



      --
      --
      ~kaeli~
      If you drink, don't park. Accidents cause people.



      Comment

      Working...