Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

processing a choice from a combo box

Status
Not open for further replies.

scroce

MIS
Nov 30, 2000
780
US
Looking for some sample code here. What I'm trying to do is have a form page that gives users a combo box with 3 choices in the combo box.

The idea is that the user picks one of the three in the combo box and then has a choice of two command buttons. The first allows them to view a pdf file.

The second would allow them to actually download the file to their machine, kind of like when you click on a href link that points to a file. I've written the following:


here is the combo box
<select name=&quot;lstFileName&quot;>

<option value=&quot;forms/ArchEng.pdf&quot; selected> Architects and Engineers Application</option>

<option value=&quot;forms/EmpPracApplication.pdf&quot;>Employment Practices Liability and Discrimination Insurance Application</option>

<option value=&quot;forms/EmpPracIndicationSheet.pdf&quot;> Employment Practices Liability and Discrimination Insurance Indication Sheet </option>

here is the first button
<input type=&quot;button&quot; value=&quot;View/Print Form&quot; id=&quot;btnViewForm&quot; name=&quot;btnViewForm&quot; onclick=&quot;window.open (lstFileName.optionslstFileName.selectedIndex].value)&quot;><BR><BR><STRONG>- Or - </STRONG>

here is the second button
<input type=&quot;button&quot; value=&quot;Download Form&quot; id=&quot;btnDownloadForm&quot; name=&quot;btnDownloadForm&quot; onclick=&quot;????????&quot;>

The first button works fine, but I'm stumped on how I can capture the user's choice in the combo box and then tell the page to download on button #2. Is there a &quot;download&quot; method somewhere that I can manipulate somewhere?
How much more water would there be in the ocean if it weren't for sponges?
 
Just zip the file and put it in the href --

then, just open it just like you did with the .pdf, except with the .zip extension --

problem is that any browser is going to recognize that .pdf extension and try to interpret it - zipping is the easiest work around for this problem

good luck! :)
Paul Prewett
penny.gif
penny.gif
 
ah. now i see what you mean. Even if you provide a simple href, it'll just open it up directly.

The only problem with zipping the file is that what if the user on the other end doesn't have a zipping program. I anticipate my users probably will not.

I may regret asking this, but is there any other way to tell the broswer not to open the file but to download it instead? How much more water would there be in the ocean if it weren't for sponges?
 
If you search this site, there have been answers to this question in the past, and if I remember correctly, it had something to do with setting the... oh, I can't remember what it was now. But it did seem like a lot of work.

Here's an idea -- make a self-extracting zip file. Winzip makes that a snap. Then, any client will be able to open the file. Browsers will download those, too. (.exe)

:)
paul
penny.gif
penny.gif
 
thanks paul - i appreciate the advice and have taken it. It seems to work just fine.

I didn't even know that winzip allows you to construct a self extracting file! - yet another new thing I've learned.

thanks again


How much more water would there be in the ocean if it weren't for sponges?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top