Ken scratched out in the sand
On Thu, 30 Sep 2004 14:44:59 GMT, Justin Koivisto <sp**@koivi.com>
wrote:
You could use javascript to build the order lines part of the form
I can see this working, each entry row would look something like this:
<tr>
<td><input type="text" size="4" name="quantity[]"></td>
<td><input type="text" size="35" name="item[]"></td>
<td><input type="text" size="4" name="price[]"></td>
</tr>
Then you could store that same string in a javascript variable. Make a
"Add another row" link that would fire the JS function to add the
additional row in the appropriate place.
When would you have it fire?
I've done this in both PHP and ASP. I cannot currently find my PHP code but
I have the ASP example. It allows for a new row to be entered by clicking a
button...
<input type="button" tabindex="11" value="Add Secondary APN"
onclick="addRow('tblBatch')" id=button1 name=button1>
....which fires off some javascript...
function addRow(id){
var tbody = document.getElementById(id).getElementsByTagName(" TBODY"
[0];
var row = document.createElement("TR");
var td1 = document.createElement("TD");
td1.align = 'right';
td1.appendChild(document.createTextNode("Secondary APN:"));
var td2 = document.createElement("TD");
td2.align = 'left';
var myinput = document.createElement("<INPUT name='txt2APNNo'
id='txt2APNNo' size='20' onBlur=validRequired(this,\"Secondary-APN\")>");
td2.appendChild(myinput);
row.appendChild(td1);
row.appendChild(td2);
tbody.appendChild(row);
myinput.focus();
}
...and adds an item to an array. You just then parse the array when you get
your form submitted. I even have an onBlur event to ensure that the new
field got filled-out before submitting.
This works fine in Netscape and IE.
--
kai - kai at 3gproductions dot com
www.gamephreakz.com ||
www.filesite.org
"friends don't let friends use windows xp"