SunQuest
           ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 27th, 2004, 03:39 PM
machito machito is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 34 machito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 17 sec
Reputation Power: 4
Updating multiple files with one click

Hello everyone:
I am designing a web photo album where users can upload and see their pictures. Each thumbnail picture will have a checkbok and there will be a button (delete and email). I want the application to delete or email all the selected pictures with a single button click. Does anybody know how to handle this?
I know how to delete one picture at a time(e.g. delete.cfm?photoID=#thisID#); but not multiple pictures at once.

Thanks,
machito

Reply With Quote
  #2  
Old October 27th, 2004, 03:57 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
Give each checkbox a unique value (the image name or image path probably). When you submit the form, all of the values that were checked should post to the action page as a comma-delimited list. Loop over that list and for each image do whatever you want.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old October 27th, 2004, 04:17 PM
machito machito is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 34 machito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 17 sec
Reputation Power: 4
Hello Kiteless:
The problem is I am looping through the query RecordCount. Do I have to assign a name for each file's checkbox?.
e.g.

<cfoutput query="getImages">
<img src = "#myDir##getImages.ImageName#">
<input type="checkbox" value="#imageID#">
</cfoutput>

I don't know in advance the number of images in the database. Thus, I cannot predict the number of checkboxes needed.

Thanks,
machito

Reply With Quote
  #4  
Old October 27th, 2004, 04:37 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
<cfoutput query="getImages">
<img src = "#myDir##getImages.ImageName#">
<input type="checkbox" name="imageChooser" value="#imageID#">
</cfoutput>

You don't need to predict how many checkboxes you need...they all must have the same name, only the values are different.

Reply With Quote
  #5  
Old October 30th, 2004, 05:47 PM
Panther893's Avatar
Panther893 Panther893 is offline
MostarDesigns.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Posts: 807 Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 5 Days 18 h 38 sec
Reputation Power: 56
Send a message via MSN to Panther893
Thumbs up

i belive i can answer your question, when i was making my shopping cart i had a similar problem because i wanted people to be able to edit their contents from the view cart level and thats a bit complicated to do. so here is my explenation in short...

ok this is a sloppy version of how i would do it.

This is for your display page:

<input size="1" type="hidden" name="numberofforms" value="<cfoutput>#getImages.recordcount#</cfoutput>">
<cfset formnumber = 1>
<cfoutput query="getImages">
<input size="1" type="hidden" name="ID#formnumber#" value="#ID#">
<img src = "#myDir##getImages.ImageName#">
<input type="checkbox" name="imageChooser#formnumber#" value="1">
<cfset formnumber = #formnumber# + 1>
</cfoutput>


This is for your action page:
(example is if you want to delete images from a database)

<cfloop index="loopcount" from="1" to="#FORM.numberofforms#">
<cfset variables.imageChooser="form.imageChooser#Evaluate(LoopCount)#">
<cfset variables.imageChooser="#Evaluate(variables.imageChooser)#">
<cfset variables.ID="form.ID#Evaluate(LoopCount)#">
<cfset variables.ID="#Evaluate(variables.ID)#">
<cfquery name="picturedelete" datasource="#datasourcename#" blockfactor="100">
DELETE FROM getImages
WHERE ID = #variables.ID#
</cfquery>
</cfloop>



now there may be better ways to do it or even ways to better that code but i found thats the easiest way to do it.
let me know if it works

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Updating multiple files with one click


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway