save dynamicaly created table to the database....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aashishn86
    New Member
    • Mar 2009
    • 51

    save dynamicaly created table to the database....

    hi
    i am using this code for adding /deleting rows dynamically :

    Code:
    function addRow()
    {
      var tbl = document.getElementById('applications');
      var lastRow = tbl.rows.length;
      // if there's no header row in the table, then iteration = lastRow + 1
      var iteration = lastRow;
      var row = tbl.insertRow(lastRow);
    
      
      // right cell
      var cellRight = row.insertCell(0);
      var el = document.createElement('input');
    
      el.type = 'text';
      el.name = 'application_field1' + iteration;
      el.id = 'application_field1' + iteration;
      el.size = 45;
      el.className='cellData';
      el.style.width='220px'
      el.style.height='17px'
      el.title='Enter Application Name'
      //el.onkeypress = keyPressTest;
      cellRight.appendChild(el);
      
      
      
      var cellMiddle = row.insertCell(1);
      var fl = document.createElement('input');
    
      fl.type = 'text';
      fl.name = 'application_field2' + iteration;
      fl.id = 'application_field2' + iteration;
      fl.size = 45;
      fl.className='cellData';
      fl.style.width='220px'
      fl.style.height='17px'
      fl.title='Enter Application Ticket Number'
      //el.onkeypress = keyPressTest;
      cellMiddle.appendChild(fl);
      
      
      var cellLeft = row.insertCell(2);
      var gl = document.createElement('input');
    
      gl.type = 'text';
      gl.name = 'application_field3' + iteration;
      gl.id = 'application_field3' + iteration;
      gl.size = 45;
      gl.className='cellData';
      gl.style.width='220px'
      gl.style.height='17px'
      gl.value='mm/dd/yyyy'
      gl.onfocus= function() {gl.value=""};
      gl.title='Enter Application Ticket Number'
      //el.onkeypress = keyPressTest;
      cellLeft.appendChild(gl);
    
      }
      
      function removeRow()
    {
      var tbl = document.getElementById('applications');
      var lastRow = tbl.rows.length;
      if (lastRow > 3) tbl.deleteRow(lastRow - 1);
    }

    how can i save these to the database ??
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Originally posted by aashishn86
    how can i save these to the database ??
    in general, create a form, insert the data to save, submit the form*, use a server script to save the submitted data to the DB.

    * - can also be done via AJAX

    Comment

    • aashishn86
      New Member
      • Mar 2009
      • 51

      #3
      i create the form...
      and submit the page to another page...
      now how do i access this data on the other page ???

      Comment

      • aashishn86
        New Member
        • Mar 2009
        • 51

        #4
        hi
        i have been able to retreive the valeues in the next form using
        request.form

        what do i do next to save them in sql

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          That's not a JavaScript question. Ask in the forum relevant to your server-side language.

          Comment

          • aashishn86
            New Member
            • Mar 2009
            • 51

            #6
            sorry..
            can you move it to the asp forum please...

            Comment

            Working...