Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Server Side Programming > ASP and ASP.NET
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 08-24-2009, 12:01 PM
  #1
Bobba Buoy
Super Deity (Level 18)
 
Bobba Buoy's Avatar
 
Join Date: Apr 2003
Posts: 1,053
iTrader: (0)
Bobba Buoy is on a distinguished road
Form Not Identifying Checkboxes checked correctly

I have a form and I am trying to determine which checkboxes are selected and which ones are not. Here is the html:

Code:
<table>
		<%For i = 0 To UBound(Items, 2) - 1 step 4%>
			<tr>
				<td style="white-space:nowrap;">
					<input type="checkbox" name="items_<%=Items(0, i)%>" 
						id="items_<%=Items(0, i)%>" checked>&nbsp;<%=Items(1, i)%>
				</td>
				<td style="white-space:nowrap;">
					<%If CInt(i + 1) <= UBound(Items, 2) - 1 Then%>
						<input type="checkbox" name="items_<%=Items(0, i + 1)%>" 
							id="items_<%=Items(0, i + 1)%>" checked>&nbsp;<%=Items(1, i + 1)%>
					<%Else%>
						&nbsp;
					<%End If%>
				</td>
				<td style="white-space:nowrap;">
					<%If CInt(i + 2) <= UBound(Items, 2) - 1 Then%>
						<input type="checkbox" name="items_<%=Items(0, i + 2)%>" 		id="items_<%=Items(0, i + 2)%>" checked>&nbsp;<%=Items(1, i + 2)%>
				       <%Else%>
					       &nbsp;
				        <%End If%>
				</td>
				<td style="white-space:nowrap;">
					<%If CInt(i + 3) <= UBound(Items, 2) - 1 Then%>
						<input type="checkbox" name="items_<%=Items(0, i + 3)%>" 
							id="items_<%=Items(0, i + 3)%>" checked>&nbsp;<%=Items(1, i + 3)%>
					<%Else%>
						&nbsp;
					<%End If%>
				</td>
			</tr>
		<%Next%>
	</table>
Here is the asp ( know the arrays are pulling the correct records from the db):

Code:
	i = 0
	ReDim RprtItems(0)
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql = "SELECT GrdbkItemsID FROM GrdbkItems WHERE ClassesID = " & lThisClass
	rs.Open sql, conn, 1, 2
	Do While Not rs.EOF
		RprtItems(i) = rs(0).Value
		i = i + 1
		ReDim Preserve RprtItems(i)
		rs.MoveNext
	Loop
	rs.Close
	Set rs = Nothing
	
	For i = 0 To UBound(RprtItems) - 1
		If Request.Form.Item("items_" & RprtItems(i)) = "on" Then
			sql = "INSERT INTO GrdbkRprtsItems (GrdbkRprtsID, ItemID) VALUES (" & lGrdbkRprtsID & ", " & RprtItems(i) & ")"
			Set rs = conn.Execute(sql)
			Set rs = Nothing
		End If
	Next
Thanks a ton!
__________________
Bobba Buoy
Just trying to make sense of it all ...

Last edited by Bobba Buoy : 08-24-2009 at 12:05 PM.
Bobba Buoy is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-24-2009, 12:10 PM
  #2
Bobba Buoy
Super Deity (Level 18)
 
Bobba Buoy's Avatar
 
Join Date: Apr 2003
Posts: 1,053
iTrader: (0)
Bobba Buoy is on a distinguished road
Now it seems to be working so "never mind."
__________________
Bobba Buoy
Just trying to make sense of it all ...
Bobba Buoy is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-29-2009, 03:34 AM
  #3
JosephJames
Fighter (Level 4)
 
Join Date: Aug 2009
Posts: 37
iTrader: (0)
JosephJames is an unknown quantity at this point
Quote:
Originally Posted by Bobba Buoy View Post
Now it seems to be working so "never mind."
When it happens like this, it drives me mad. The same way it can break and will not know why this happend.
JosephJames is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 10:55 PM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.