Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Array help: Checkbox delimiter?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 29 October 2001 :  13:53:34  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
What is used as a delimiter when I have multiple checkboxes with the same name, and more than one are checked?

---------------
Da_Stimulator has spoken

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 29 October 2001 :  14:06:09  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
This is the current code I have, I'm just not sure if "," is the correct delimeter...


t_a_formdata = Split(request.form("approve"), ",")
t_a_size = Ubound(t_a_formdata) - 1

Dim I
for I=0 to t_a_size
strsql = "UPDATE TOPLIST SET ADMINDISPLAY=1 WHERE SITEID=" & t_a_formdata(I)
t_conn.execute(strsql)
next


---------------
Da_Stimulator has spoken
Go to Top of Page

MorningZ
Junior Member

USA
169 Posts

Posted - 29 October 2001 :  14:30:39  Show Profile  Visit MorningZ's Homepage  Send MorningZ an AOL message
why dont you just display it?

Response.Write Request.Form("approve")

commas it is

For each item in Request.Form("approve")
'Process
Next


works great as well


Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 29 October 2001 :  14:43:25  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
Well I've advanced it a little bit, I now have 2 arrays to work with, but its not working...

t_a_formdata holds values such as "1|approve,2|delete,3|approve"
t_a_size the size of t_a_formdata
t_a_size1 the real size (put in dfferent variable to work with...}
t_a_formprocess I want to be either 'approve' or delete
over all function to distinguish whether to approve or delete a site...

Error I'm getting
Microsoft VBScript compilation error '800a0402'

Expected integer constant

/ss/toplist/admin_approve.asp, line 14

Dim t_a_formprocess(t_a_size1)


code


t_a_formdata = Split(request.form("approve"), ",")
t_a_size = Ubound(t_a_formdata)
t_a_size1 = Cint(t_a_size) - 1

Dim I
Dim t_a_formprocess(t_a_size1)
for i=0 to t_a_size
t_a_formprocess(I) = Split(t_a_formdata(I), "|")
Next
for I=0 to t_a_size1
if t_a_formprocess(I) = "approve" then
strsql = "UPDATE TOPLIST SET ADMINDISPLAY=1 WHERE SITEID=" & t_a_formdata(I)
t_conn.execute(strsql)
else
strsql = "DELETE FROM TOPLIST WHERE SITEID=" & t_a_formdata(I)
end if
next


---------------
Da_Stimulator has spoken
Go to Top of Page

MorningZ
Junior Member

USA
169 Posts

Posted - 29 October 2001 :  19:28:02  Show Profile  Visit MorningZ's Homepage  Send MorningZ an AOL message
Expected integer constant

/ss/toplist/admin_approve.asp, line 14

Dim t_a_formprocess(t_a_size1)

=================================
In an array setup, the number has to be, ta da, a constant, declared such as:
CONST t_a_size1 = 8

its a pain in the butt to have an array change dimensions on the fly

do this instead ( and much less code ):

for each I in Split(request.form("approve"), ",")
splitMe = Split( i, "|" )
if splitMe(1) = "approve" then
strsql = "UPDATE TOPLIST SET ADMINDISPLAY=1 WHERE SITEID=" & splitMe(0)
else
strsql = "DELETE FROM TOPLIST WHERE SITEID=" & splitMe(0)
end if
t_conn.execute(strsql)
next




Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07