|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 03:37 AM. |
|
#2
|
|||
|
|||
|
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! ![]() |
|
#3
|
|||
|
|||
|
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 12:50 PM. |
|
#4
|
|||
|
|||
|
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 ------------------------------------------------------------------------ |
|
#5
|
|||
|
|||
|
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? ![]() |
|
#6
|
||||
|
||||
|
Another method of iterating thru forms.
for each element in request.form ... next |
|
#7
|
|||
|
|||
|
Thanks guys,
The Hotmail clone is almost complete ---------------------------------------------------------------------------- So much trouble in the World -- Bob Marley ---------------------------------------------------------------------------- |
|
#8
|
|||
|
|||
|
Cool, can I see it when you're done?
|
|
#9
|
|||
|
|||
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 ---------------------------------------------------------------------------- |
|
#10
|
|||
|
|||
|
Sounds good.
![]() |
|
#11
|
|||
|
|||
|
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 02:48 PM. |
|
#12
|
|||
|
|||
|
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... ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > Back to Checkboxes -- Help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|