ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 20th, 2003, 02:30 AM
Kruzien2002 Kruzien2002 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Jamaica
Posts: 25 Kruzien2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Control the Checkboxes -- Help

Ello there,

I have reached a problem. See if you can lend a hand

Why :
Email websites, example hotmail, yahoo, etc have checkboxes to the right and when the user selects them has the option to delete email/record. I NEED the same facility to make the app more user friendly.
The problem is i'm not been able to do this.

What I tried:
eg. <input name=MNM_1 type=checkbox value="RG23343">
Iterating though the MNM on the ASP side by using the _&val
changes. Request.Form("MNM_"&val)


Ques :-
1) What is used to store the value of the ones selected to be sent to the ASP page on submit.

2) Even if you name the checkbox and assign value based on the records id, considering a dynamic list how do you know which is which.

3) Most people use alot of javascipt to operate the selection of checkboxes on the client side how is this sent to the Script and processed.

4) And does any one have a resource i can look up about this.

NB.
I'm not clear explaining it to myself so if you not getting my question let me know.
Begging for assistance


----------------------------------------------------------------------------
..War is not the problem its the minds and the hearts of men.. - Abijah(Revelation)
---------------------------------------------------------------------------

Last edited by Kruzien2002 : February 20th, 2003 at 02:37 AM.

Reply With Quote
  #2  
Old February 20th, 2003, 10:11 AM
DeviantScripter DeviantScripter is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 22 DeviantScripter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Okay, let me take a shot at this one. I'm kind of wading my way through this for my own website also.

Okay, so you have your first page, with which you want a few rows of checkboxes, with some text next to it; like Hotmail right? So use this code to print the checkboxes:

<input type="checkbox" name="del" value="<%=(rsProducts.Fields.Item("ID").Value)%>">

You want the unique ID number to appear in the "Value=" of the checkboxes' attributes.

Next, on your delete page, you're basically going to loop through the submitted form values, and stick all the "checked" boxes in an array, then delete the values from your DB:

<%

[COLOR=sea-green]'Your connection and recordset code goes here[/COLOR]

strIDs = Replace(Request.Form, "&del=", ",")
strIDs = Replace(strIDs, "del=", "")
arrIDs = Split(strIDs, ",")

For intCount = 0 To UBound(arrIDs)
rsProducts.Filter = "ID = " & arrIDs(intCount)
rsProducts.Delete
Next
rsProducts.Close()
Response.Redirect("default.asp")

%>


Lemme know if you need anymore help! Good Luck!

Reply With Quote
  #3  
Old February 20th, 2003, 11:44 AM
Kruzien2002 Kruzien2002 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Jamaica
Posts: 25 Kruzien2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ello agian,

DeviantScripter I was thinking about that. I understand the database interaction stuff and the form section. The problem is the looping though the Request object

You said --
..Next, on your delete page, you're basically going to loop through the submitted form values, and stick all the "checked" boxes in an array...

That is my problem.

Please could you explain that section. Cause i tried it your idea but still not getting it.

Usually when i get values from a form I explicitly use the element names eg. Request.Form( key )
The only way i figure i could iterate though is by using the method i mentioned in original post. But in this case it wouldn't work because the checkbox have the same name.

Otherwise getting an error -- Type mismatch: 'UBound'


Thanks again




----------------------------------------------------------------------------
... I and I want to rule I destiny... Buju Banton
-----------------------------------------------------------------------------

Last edited by Kruzien2002 : February 20th, 2003 at 11:50 AM.

Reply With Quote
  #4  
Old February 20th, 2003, 12:54 PM
Kruzien2002 Kruzien2002 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Jamaica
Posts: 25 Kruzien2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Good news,

Found how that iterating thing goes, i can't believe i didnt remember that.

Thanks again DeviantScripter but about the UBound could you explain that section for me.

And to any one who has the same problem with checkboxes here is a resource which will sort all you problems out.

http://www.asp101.com/samples/viewa...=checkbox%2Easp




-------------------------------------------------------------------------
... I can see clearly now the rain is gone..... Jimmy Cliff
------------------------------------------------------------------------

Reply With Quote
  #5  
Old February 20th, 2003, 01:52 PM
DeviantScripter DeviantScripter is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 22 DeviantScripter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
When you have an array, often you want to know how many items are stored in that array. That's where UBound comes in. For example:

DIM MyArray(3)
UBound(MyArray) = 3

See, kinda cool huh?

Reply With Quote
  #6  
Old February 21st, 2003, 07:46 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Posts: 2,056 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
Another method of iterating thru forms.


for each element in request.form
...
next

Reply With Quote
  #7  
Old February 23rd, 2003, 02:52 PM
Kruzien2002 Kruzien2002 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Jamaica
Posts: 25 Kruzien2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking

Thanks guys,

The Hotmail clone is almost complete









----------------------------------------------------------------------------
So much trouble in the World -- Bob Marley
----------------------------------------------------------------------------

Reply With Quote
  #8  
Old February 23rd, 2003, 04:34 PM
DeviantScripter DeviantScripter is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 22 DeviantScripter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Cool, can I see it when you're done?

Reply With Quote
  #9  
Old February 24th, 2003, 01:38 AM
Kruzien2002 Kruzien2002 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Jamaica
Posts: 25 Kruzien2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0


Well it's actually for an intranet setup to manage the mail we get but maybe i submit it to your site when it gets up or to devscripts for you guys to destroy a mans ego.

The internet version that is. Lets see how that goes






----------------------------------------------------------------------------
Micheal Jordan the greatest to ever play -- Is I say so
----------------------------------------------------------------------------

Reply With Quote
  #10  
Old February 24th, 2003, 02:31 PM
DeviantScripter DeviantScripter is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 22 DeviantScripter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sounds good.

Reply With Quote
  #11  
Old February 26th, 2003, 01:15 PM
Kruzien2002 Kruzien2002 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Jamaica
Posts: 25 Kruzien2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
DeviantScripter,

One more thing i tried using the databse stuff

rsProducts.Filter = "ID = " & arrIDs(intCount)
rsProducts.Delete


I stead of the straight delete statement I use. ie. Using a Access database.

NB. doesn't filter remove a record from being visible in a recordset.
-- Isn't the delete section to be
rsProduct.Delete arrIDs(inCount) or one of the parameters

Anyway i'm getting this error

Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.


And another Ques. when in 2003 will your site be up.

Last edited by Kruzien2002 : February 26th, 2003 at 01:48 PM.

Reply With Quote
  #12  
Old February 27th, 2003, 08:45 AM
DeviantScripter DeviantScripter is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 22 DeviantScripter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I think the problem you're having might have something to do with the cursortype you're using. In any event, check out this article, I think you'll find what you need in here:
http://www.4guysfromrolla.com/webtech/112998-1.shtml

If that doesn't work, let me know and we can try something else.

As for my site, I'm hoping to have it up within a month or two. Wanna see it when it's done? It'll be tight...

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Back to Checkboxes -- Help


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap