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!

creating more textboxes on the same form

Status
Not open for further replies.

bells

MIS
Oct 5, 2001
51
CA
Hello

I have a form which is holding
a text box where users will type a number inside
once they type that number (let say 5) then
other 5 text boxes will appear on the same form below
what should i do to do this i know i need to do
looping(for...Next) the problem i have is to get the value from
the txet box and make the other appear on the same form
thanx in advance
 
two way...client side and server side

I would choose clinet side as it would be more efficient
eg: DOM

or if you wanted on the server it would be fairly simple. just set the form up in a condition if or case on a form object being passed..(the number they want)

if the request.form value is more then "" then loop reiterating to the number
eg:
Code:
If request.form("userCount") <> "" Then
Dim x : x = 0
  Do While x <= request.form("userCount")
     response.write "<input type=""text"" name=" & Chr(34) & x & "name" & Chr(34) & ">"
  x = x + 1
  Loop
Else
     response.write "<input type=""text"" name=""userCount"">    
etc...

___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 

well that seems a bit complicated for me
can we write a code VBScript where it triggers
whe we r losing the focus of the text boxes which is holding the number??

Thanks agian
 
You can use this also
Code:
<script>
function add()
{
	var frm=document.forms[0]
	var store=document.getElementById("store")
	if(frm.nrin.value!=""&&!isNaN(frm.nrin.value))
	{
		nr=new Number(frm.nrin.value)
		for (i=0;i<nr;i++)
			store.innerHTML+="<input name='val'><br>"
	}
}
</script>
<body>
<form>
	<input name="nrin" size=2><input type=button value="Add" onclick="add()">
	<div name="store" id="store"></div>
</form>
</body>

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top