Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
looping through checkboxes on form
Old 08-19-2004, 08:25 AM looping through checkboxes on form
tonya's Avatar
Ultra Talker

Posts: 485
Location: world traveller based in UK
Trades: 0
Hi (first time actually posted ASP query) have left my dev folder & books at home & am away. working with friend who wants me to loop through some checkboxes & extract their name & value. actually i want an if statement that says if they are empty write nothing & if they arent then extract name & value of checkbox. i know how to do the if & extract the values etc but not the loop. at the moment i have really long code that looks at each checkbox tests if its empty & if it isnt then extracts the values I need.

can anyone help? this is what my code is starting to look like because i cant remember my looping stuff !

Dim strSC, strCDRom, strGLS
strSC = Trim(Request.Form("shortform catalogue"))
strCDROM = Trim(Request.Form("catalogue on CD Rom"))
strGLS = Trim(Request.Form("Guard Locking systems"))
If strSC = "" Then
strMain = strMain
Else
strMain = strMain & "Shortform catalogue: " & strSC &vbcrlf
End If
If strCDROM = "" Then
strMain = strMain
Else
strMain = strMain & "catalogue on CD Rom " & strCDROM &vbcrlf
End If

& there are 19 of these checkboxes
thanks
__________________
Tonya

::
Please login or register to view this content. Registration is FREE
::
Please login or register to view this content. Registration is FREE
tonya is offline
Reply With Quote
View Public Profile Visit tonya's homepage!
 
 
Register now for full access!
Old 08-21-2004, 10:56 PM
melfan's Avatar
Skilled Talker

Posts: 90
Trades: 0
Quote:
Originally Posted by tonya
Hi (first time actually posted ASP query) have left my dev folder & books at home & am away. working with friend who wants me to loop through some checkboxes & extract their name & value. actually i want an if statement that says if they are empty write nothing & if they arent then extract name & value of checkbox. i know how to do the if & extract the values etc but not the loop. at the moment i have really long code that looks at each checkbox tests if its empty & if it isnt then extracts the values I need.

can anyone help? this is what my code is starting to look like because i cant remember my looping stuff !

Dim strSC, strCDRom, strGLS
strSC = Trim(Request.Form("shortform catalogue"))
strCDROM = Trim(Request.Form("catalogue on CD Rom"))
strGLS = Trim(Request.Form("Guard Locking systems"))
If strSC = "" Then
strMain = strMain
Else
strMain = strMain & "Shortform catalogue: " & strSC &vbcrlf
End If
If strCDROM = "" Then
strMain = strMain
Else
strMain = strMain & "catalogue on CD Rom " & strCDROM &vbcrlf
End If

& there are 19 of these checkboxes
thanks
You must name your checkboxes with same name and loop like this:

For counter = 1 To Request.Form("checkboxname").Count
Response.Write "You selected " & Request.Form("interests")(counter) & "<br>"
Next
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
melfan is offline
Reply With Quote
View Public Profile Visit melfan's homepage!
 
Reply     « Reply to looping through checkboxes on form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.84060 seconds with 12 queries