PDA

Click to See Complete Forum and Search --> : Adding controls at runtime VBScript?


msuryadarma
Oct 4th, 2000, 10:40 AM
hi all,

I have this on vb app, and it works fine, it creates however many textboxes depending on the input (GuestNum). It uses index, btw.

Public Sub ShowGuestBoxes()

For Counter = 1 To (frmOpening.GuestNum - 1) Step 1
Load txtGuestEat(Counter)
txtGuestEat(Counter).Visible = True
Next Counter

End Sub

Now how do I do this in VbScript/ASP?

On my asp page, I am receiving GuestNum using Request Form, then I want to create those textboxes on the page.

I tried the same method as in VB App, but keep getting errors. Any ideas? Thanks a lot.

Martin

msuryadarma
Oct 4th, 2000, 10:47 AM
This is what's in my ASP file:

------------------------------
<%@ LANGUAGE="VBScript" %>
<html>

<head>
<title></title>
</head>

<body>

<form NAME="frmBoxes">
<table>
<tr>
<td><b>Guest Eats:</b></td>
<td><input TYPE="text" NAME="txtGuestEat" SIZE="15"> </td>
</tr>
<tr>
<td><table>
</table>
</td>
</tr>
</table>
</form>

<%
Dim GuestNum

GuestNum = Request.Form("txtGuestNum")

For Counter = 1 to GuestNum
Load txtGuestEat(Counter)
Next Counter

%>

</body>
</html>
------------------------------

I keep getting errors such as Object Required, I tried putting Document.frmBoxes.txtGuestEat(Counter) and it doesn't work. Is this even possible?

msuryadarma
Oct 4th, 2000, 02:02 PM
Never mind, I got it. Heheheeh.

Silly me, it took me so long to realize that Response.Write is just like writing html code. SLICK!!!

Thanks anyway.