Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Active Cell Offset Question???

Status
Not open for further replies.

ramnewbietoaccess

Programmer
Nov 4, 2002
52
US
I'm sorry I dont know how to better describe the question in HTML so I used excel terminology lol....

I have 100 text boxes in rows for a user to possibly fill from two different dynamic list boxes to autopopulate the item and the cost.....I am wondering how to make the list box find the first empty row and autopopulate the text box by their selection as you can do in excel. The code I presently am using is this but I would need a list box for every line....Is there a way to have it find the first empty text box in the rows?


<script language="javascript"><!--
function giveToText(str) {
var f = document.forms['f'];
var s + str.split(" - ");
f.elements['the_price'].value = s[0];
f.elements['the_item'].value = s[1];
}
--></script>

</head>
<body>
<form name="f">
<select name="s" onchange"giveToText(this.options[this.selectedIndex].value;">
<option value=$12.00 - Hotdogs">$12.00 - Hotdogs</options>
</select>
<br />
<input type"text" name="the_price" />
<input type"text" name="the_item" />
</form>
</body>

thank you in advance for any suggestions or advice
 
There are probably any number of ways to do this. If you name all of your text boxes on a row with the same name, you can loop thru them all looking for a blank one by using the getElementsByName method, which returns a collection (i.e. an array) of all elements with the same name. Then just check for the first one with a null value.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top