Hi, I am creating a form that populates the form input boxes based on the user selection from a dropdown box shown in the form code below.
this creates a for wher the user can select an hour and minute
dropdown to create an appointment for each service area (svar) they would like their order fulfilled. As a result it is possible for the form to have anywhere from 1 to 165 area to select appointments that apply to them. I would like to take their selections and insert them into my database.
apptdate, area1, area2, area3, area4, area5
so the apptdate is easy, but if the user creates a form that choose areas 1,3,5
my request.form("lights_hour") and request.form("lights_minute") with the following times:
13:30, 14:31, 15:32
gives me a values of
13, 14, 15, 30, 31, 32
which is the three hour values as one value separated with a comma and the three minute values separated by a comm. What I want to do at this point is create a two dimensional array so that I can combine the appropriate hour with the appropriate minute and turn 13, 14, 15, 30, 31, 32 into 13:30, 14:31, 15:32 so that I can write my insert statement with those values. What I have so far goes something like this:
lights_hour = request.Form("lights_hour")
lights_minute = request.Form("lights_minute")
svar_num = request.form("svar_num")
hourArray = split(lights_hour,",")
minuteArray = split(lights_minute,",")
svar_numArray = split(svar_num,",")
dim timeArray(2,uBound(svar_numArray))
for i=0 to uBound(svar_numArray)
timeArray(0,i) = hourArray(i)
timeArray(1,i) = minuteArray(i)
next
I am getting this error message:
Expected integer constant
/includes/service/fsoslights.asp, line 65
dim timeArray(2,uBound(svar_numArray))
--------------------^
I really hope this makes sense and someone is able to help me or give me another suggestion on how to tackle this problem thanks in advance. Marcus.
'form code
<form method="post" action="fsoslights.asp">
<div align="center">
<table cellpadding="0" cellspacing="0" border="1" bordercolor="#CCCCCC">
<tr><td>
<select name="selLights">
<option value="all" selected="selected">All</option>
<option value="tn">TN</option>
<option value="gw">GW</option>
<option value="416tn">416 TN</option>
<option value="416gw">416 GW</option>
<option value="519tn">519 TN</option>
<option value="519gw">519 GW</option>
<option value="613tn">613 TN</option>
<option value="613gw">613 GW</option>
<option value="705tn">705 TN</option>
<option value="705gw">705 GW</option>
<option value="905tn">905 TN</option>
<option value="905gw">905 GW</option>
</select>
</td>
<td colspan="12">
<input type="submit" value="submit">
<%
i = 1
set lightsRS = objADOconn.execute(strLights)
do until lightsRS.eof
%>
<tr>
<td>
<%=(lightsRS("SVAR")&"<br>")%>
</td>
<td>
<select name='lights_hour'>
<option value="HH">HH</option>
<% for counter = 0 to 24 %>
<option value="<%=counter%>" <% if counter = hour(LightsDate) then %> selected <% end if %>><%=counter%></option>
<%next%>
</select>
<select name='lights_minute'>
<option value="MI">MI</option>
<% for counter = 0 to 60 %>
<option value="<%=counter%>" <% if counter = minute(LightsDate) then %> selected <% end if %>><%=counter%></option>
<%next%>
</select>
</td>
</tr>
<%
i = i + 1
<input type="hidden" value="<%=i%>" name="svar_num">
lightsRS.movenext
loop
%>
by: SquareHeadPosted on 2008-01-10 at 12:16:09ID: 20630682
One way you might do this is instead of the array idea, add a hidden form field to your loop, so that for each hour/minute pair of dropdowns you also have a hidden form field.
Then, using the onclick event of each of the dropdowns, concatenate the two dropdown values into one value and set that into the hidden field. Then look at that field when the form is submitted.
Make sense?