|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
This is a very urgent requirement of mine. Please help me if you can.
The situation is like this. There is a form, which has a coloumnar layout, the data will come in rows (remember the microsoft access table structure). Now, a person fills up one row of data, and presses enter. On enter, the cursor will move to the next row, for more data entry. My problem is, how to move the form elements (textbox, list box) to the next row, keeping the first row of data still displayed (microsoft access table structure). Initially only one row of form fields will be displayed and gradually the number of rows will increase as the data entry happens. |
|
#2
|
|||
|
|||
|
I suppose you ment by MsAccess form both the HTML form and the the table.
Here you have a sample for IE. Also consult MSDN documentation for more information about Javascript DOM. <html> <head> <script language=javascript> <!-- function insertRow() { var row = Math.abs(document.myFrm.hdnCrtRow.value); var tbl = document.all("myTable"); var txt = document.myFrm.myTxt.value; var tr = tbl.rows(row); var td = tr.cells(0); td.innerText = txt; row ++; tr = tbl.insertRow(); tr.setAttribute("bgcolor", "beige", false); td = tr.insertCell(); td.innerHTML = "<input type=text name=myTxt>"; document.myFrm.hdnCrtRow.value = row; document.myFrm.myTxt.focus(); } function fetchKey() { if (window.event.keyCode == 13) { insertRow(); return false; } } document.onkeydown=fetchKey; //--> </script> </head> <body onload="javascript:document.myFrm.myTxt.focus();"> <form name=myFrm> <input type=hidden name=hdnCrtRow value=0> <table id=myTable color=black cellpadding=1 cellspacing=1> <tr bgcolor=beige> <td><input type=text name=myTxt></td> </tr> </table> </form> </body> </html> Have fun, Dragos |
|
#3
|
|||
|
|||
|
Hi Dragos,
The piece of code that u've sent me works fine, but there is a small problem, I'm not being able to edit the data once entered. I should also be able to go back to the previous data field, if I need to modify/delete any data before actually submitting the form. Can u pls help me in this? Anyway, thanx a lot for your help. Love Papia <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by dragos: I suppose you ment by MsAccess form both the HTML form and the the table. Here you have a sample for IE. Also consult MSDN documentation for more information about Javascript DOM. <html> <head> <script language=javascript> <!-- function insertRow() { var row = Math.abs(document.myFrm.hdnCrtRow.value); var tbl = document.all("myTable"); var txt = document.myFrm.myTxt.value; var tr = tbl.rows(row); var td = tr.cells(0); td.innerText = txt; row ++; tr = tbl.insertRow(); tr.setAttribute("bgcolor", "beige", false); td = tr.insertCell(); td.innerHTML = "<input type=text name=myTxt>"; document.myFrm.hdnCrtRow.value = row; document.myFrm.myTxt.focus(); } function fetchKey() { if (window.event.keyCode == 13) { insertRow(); return false; } } document.onkeydown=fetchKey; //--> </script> </head> <body onload="javascript:document.myFrm.myTxt.focus();"> <form name=myFrm> <input type=hidden name=hdnCrtRow value=0> <table id=myTable color=black cellpadding=1 cellspacing=1> <tr bgcolor=beige> <td><input type=text name=myTxt></td> </tr> </table> </form> </body> </html> Have fun, Dragos[/quote] |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Dynamic adding of form fields |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|