JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript 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 1st, 2004, 08:46 PM
cliffhanger9 cliffhanger9 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: philly
Posts: 2 cliffhanger9 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to cliffhanger9
Question Downloading File based on Form options

hey-

i am making an image gallery where people can pick the details of the image that they want and then click a button and based on the values that are entered they will download the appropriate image

so i have this form...

with 6 radio buttons and a submit button...

O - 72 dpi
O - 150 dpi
O - 300 dpi

O - color
O - black
O - white

(Submit)

...so then the idea would be if they select a size (150 dpi) and a color (black), upon clicking submit, they would download that proper file, say image1_150_blk.jpg for example

i dont think it is too hard but yea i dont really know a whole lot of javascript so i could be wrong...but its a fun little project and i would sooo appreciate it if anyone has a script for this, or if you know what you would call this so i could search for it!! i would greatly appreciate ANY advice!!!

thank you thank you thank you in advance!!!

Reply With Quote
  #2  
Old February 1st, 2004, 09:50 PM
cliffhanger9 cliffhanger9 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: philly
Posts: 2 cliffhanger9 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to cliffhanger9
ok so far i have this...

Code:
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<script>
var optQuality
var optColor
var format

function checkvalue(format)
{
     quality =  optQuality
     color = optColor

   alert ( 'You have requested ' + format+quality+color )
}
</script>
</head>
<body>

<form name="frm" >
72 dpi: <input type="radio" name="dpi" onClick="optQuality=72"><br>
150 dpi: <input type="radio" name="dpi" onClick="optQuality=150"><br>
300 dpi : <input type="radio" name="dpi" onClick="optQuality=300"><br>

color black: <input type="radio" name="colore" onClick="optColor='Black'"><br>
color white: <input type="radio" name="colore" onClick="optColor='White'"><br>
color color: <input type="radio" name="colore" onClick="optColor='Color'"><br>
</form>
<input type="submit" value="Submit"  onClick = "checkvalue('jpg')">

</body>
</html>



how do i get them to download an image based on that input instead of getting an alert box? or both even...like have the alert pop up and then upon clicking ok or cancel the image would popup a save as dialog or cancel

like
if the input is: gif, 150 dpi, and black then they should download: logo-150-blk.gif
if the input is: gif, 150 dpi, and white then they should download: logo-150-wht.gif
if the input is: gif, 72 dpi, and black then they should download: logo-72-blk.gif
etc.

do i use something like..

location = "images/logo-150-blk.gif"

????


i m really unsure about this stuff but i would greatly appreciate any help!! thank you thank you!!!!

rock on!!

Reply With Quote
  #3  
Old February 1st, 2004, 10:16 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
You're pretty close!
You just need to be able to build the correct filenames, then direct the user to either a page with that image in it, or that image itself.... I would use server-side programming for this, otherwise your whole app won't work is someone has JS disabled.

So you submit the form, request the color and res variables, build the filename string, then redirect to the corresponding page.
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Downloading File based on Form options


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 1 hosted by Hostway