www.webdeveloper.com
Results 1 to 3 of 3

Thread: Dynamic input won't submit

  1. #1
    Join Date
    Jan 2003
    Location
    Indonesia
    Posts
    38

    Dynamic input won't submit

    Hi, there...
    I have a form consists of static form and dynamic form.
    When I submit the form, only static form submitted but not the dynamic form.
    Here's my code:

    Code:
    <form name="form1" method="post" enctype="application/x-www-form-urlencoded" action="UsrTest.asp">
    <font color="#003399"><b> 
    <script language="JavaScript">             
    <!-- Begin
    function addRow(id){
    var rows = Number(document.form1.Incr.value);
    var tbody = document.getElementById
                     (id).getElementsByTagName("TBODY")[0];
    var row = document.createElement("TR");
    row.setAttribute("bgcolor","#dde7ff");
    //create input box
    var ip1 = document.createElement("INPUT");
    ip1.setAttribute("TYPE","TEXT");
    ip1.setAttribute("NAME","TETime" + rows);
    ip1.setAttribute("size","15");
    ip1.setAttribute("class","InputBox");
    				
    var ip2 = document.createElement("INPUT");
    ip2.setAttribute("TYPE","TEXT");
    ip2.setAttribute("NAME","TEEvent" + rows);
    ip2.setAttribute("size","75");
    ip2.setAttribute("class","InputBox");
    //create column
    var td1 = document.createElement("TD");
    td1.setAttribute("bgcolor","#dde7ff");
    td1.setAttribute("align","center");
    td1.appendChild(document.createTextNode(rows));
    var td2 = document.createElement("TD");
    td2.setAttribute("align","center");
    td2.appendChild(document.getElementById("form1").appendChild(ip1));
    var td3 = document.createElement("TD");
    td3.setAttribute("align","center");
    td3.appendChild(document.getElementById("form1").appendChild(ip2));
    row.appendChild(td1);
    row.appendChild(td2);
    row.appendChild(td3);
     tbody.appendChild(row);
    document.form1.Incr.value = rows + 1;
                }
               //  End -->				  
    </script>
    </b></font>
    <table width="90%" border="0" cellspacing="2" cellpadding="1" name="EETime" id="EEtable">
    <tr> 
    <td width="5%" height="20" bgcolor="#CCCCCC"> 
    <div align="center"><font color="#000000"><b>No</b></font></div>
    </td>
    <td width="12%" height="20" bgcolor="#CCCCCC"> 
    <div align="center"><font color="#000000"><b>Time</b></font></div>
    </td>
    <td width="55%" height="20" bgcolor="#CCCCCC"> 
    <div align="center"><font color="#000000"><b>Exercise Events</b></font></div>
    </td>
    </tr>
    <tr> 
     <td width="5%" height="8"> 
    <div align="center">1</div>
    </td>
    <td width="12%" height="8"> 
    <div align="center"> 
    <input type="text" name="TETime1" size="15" class="testbox"  maxlength="8" >
    </div>
    </td>
    <td width="55%" height="8"> 
    <div align="center"><font color="#003399"><b> 
    <input type="text" name="TEEvent1" size="75" class="testbox">
    </b></font> </div>
    </td>
    </tr>
    </table>
    <table width="90%" border="0" cellspacing="0" cellpadding="0">
    <tr> 
    <td width="75%"> 
    <div align="left"> 
    <input type="hidden" name="Incr" value="2">
    <input type="button" name="btn1" value="  Add Event   " class="sbttn" onClick="addRow('EETable')">
    <input type="submit" name="Submit" value="Submit">
    </div>
    </td>
    </tr>
    </table>
    </form>

  2. #2
    Join Date
    Feb 2003
    Posts
    85
    Hi,
    change
    PHP Code:
    ip1.setAttribute("NAME","TETime" rows);
    ip2.setAttribute("NAME","TEEvent" rows); 
    to
    PHP Code:
    ip1.setAttribute("name","TETime" rows);
    ip2.setAttribute("name","TEEvent" rows); 
    Your version creates an additional attribut.

    Good luck, skriptor

  3. #3
    Join Date
    Jan 2003
    Location
    Indonesia
    Posts
    38

    Talking

    Thanx alot skriptor, it's working.
    I've been stuck for three days to debug the code.

    Thanx.....

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles