| | |||||
| ||||||||
| Web Design Discussion Discussion of web design techniques, advice, browser issues, software, design firms. |
![]() | NamePros Design Contests | Forum Sponsorship |
| Join in on the FUN! You can start an affordable design contest and pick from entries talented members submit or you can enter a design contest for a chance to win CASH PRIZES! What are you waiting for? Get started in the fun TODAY! - Banners, Logos, Mascots, and MORE! (Please READ the design Contest section rules Prior to starting or entering a contest) | ||
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| New Member Join Date: Mar 2004
Posts: 6
![]() | |
| |
| | #2 (permalink) |
| NamePros Member Join Date: Nov 2003 Location: Ontario, Canada
Posts: 127
![]() ![]() | you can put this between the <head> tags <script language="javascript"> function getFile(aForm){ var path = "path_to_docs" var fname = path + aForm.file.value + ".doc"; window.open(fname); } </script> and in the form tag add onSubmit="getFile(form1)" name the text field file If the file is not there, then the window will come up not found. This is a quick and dirty way to do it with jscript |
| |
| | THREAD STARTER #4 (permalink) |
| New Member Join Date: Mar 2004
Posts: 6
![]() | hmmm, not working I tried it, and it didn't work. I'm doing something wrong. I don't fully understand code, and I'm pretty sure I'm missing something. Here's what I have: I already had some other rollover scripts between the head tags, so I just added this one below them. function getFile(aForm){ var path = "/reports" var fname = path + aForm.file.value + ".doc"; window.open(fname); } </script> And this is my form code: <form name="form1"> ????: NamePros.com http://www.namepros.com/showthread.php?t=24767 <input type="text" name="file"> <input type="submit" name="submit" value="Download" onSubmit="getFile(form1)"> </form> But when I click on the submit button, it just refreshes the page. Any suggestions? Thanks! |
| |
| | THREAD STARTER #5 (permalink) |
| New Member Join Date: Mar 2004
Posts: 6
![]() | I figured it out a little more ok, I found my mistake. I put the "onsubmit" in the wrong place. Now it works, and the document downloads just fine, but after you click download and get the document, an error message appears in the browser window. I attached part of a screenshot of what it says. Any suggestions on how to get it to go back to page with the pin# entry? |
| |
| | THREAD STARTER #9 (permalink) |
| New Member Join Date: Mar 2004
Posts: 6
![]() | this is in the head: function getFile(aForm){ var path = "http://www.wmpis.com/reports/" var fname = path + aForm.file.value + ".doc"; window.open(fname); } and here is the form tag: <form name="form1" method="post" onSubmit="getFile(form1)" action="http://www.wmpis.com/report.htm"> <input type="text" name="file"> <input type="submit" name="Submit" value="Download"> </form> |
| |
| | #10 (permalink) |
| NamePros Member Join Date: Nov 2003 Location: Ontario, Canada
Posts: 127
![]() ![]() | Hello Seems that your page doesn't allow the post method. so try this <form name="form1"> <input type="text" name="file"> <input type="button" name="Download" value="Download" onClick="getFile(form1)"> </form> this should work. |
| |