HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 14th, 2000, 01:52 AM
papia papia is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 4 papia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old October 16th, 2000, 10:11 AM
dragos dragos is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 27 dragos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #3  
Old October 28th, 2000, 03:18 AM
papia papia is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 4 papia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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]


Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Dynamic adding of form fields


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT