NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Web Design Discussion
Reload this Page A text field link?

Web Design Discussion Discussion of web design techniques, advice, browser issues, software, design firms.

Advanced Search
10 members in live chat ~  
NamePros Design Contests 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)



Closed Thread
 
LinkBack Thread Tools
Old 03-26-2004, 10:01 AM THREAD STARTER               #1 (permalink)
New Member
Join Date: Mar 2004
Posts: 6
sarbz is an unknown quantity at this point
 



Question A text field link?


Hello,

I've been designing simple websites for about a year, and I'm just beginning to create some more complex sites. I have a question. A client of mine would like to have an area on his site where a user could enter a pin# and download a document.

Here's what I would like to do (if it's possible):
I would like to create a text field that a user can enter a pin# and click go. This would link to a document. The pin# entered would be the same name as the document. This way, my client can upload documents named after the pin number he chooses for his individual clients, and no other intervention would be required.

????: NamePros.com http://www.namepros.com/web-design-discussion/24767-a-text-field-link.html
Example:

the user would enter "1234" and click go. somehow, the 1234 would be renamed "1234.doc", or "1234.htm" and be opened.

Is this possible without using asp or php? My client is using a free hosting service that doesn't include these.

Thanks for the help!
sarbz is offline  
Old 03-26-2004, 12:15 PM   #2 (permalink)
NamePros Member
Join Date: Nov 2003
Location: Ontario, Canada
Posts: 127
eagle12 will become famous soon enougheagle12 will become famous soon enough
 



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
eagle12 is offline  
Old 03-27-2004, 06:38 AM   #3 (permalink)
NamePros Expert
 
Anthony's Avatar
Join Date: Dec 2003
Location: NYC
Posts: 9,132
Anthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant future
 

Member of the Month
October 2004

You can also do this with PHP, by using a variable for the inputted number.
Anthony is offline  
Old 03-29-2004, 06:26 AM THREAD STARTER               #4 (permalink)
New Member
Join Date: Mar 2004
Posts: 6
sarbz is an unknown quantity at this point
 



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!
sarbz is offline  
Old 03-29-2004, 06:41 AM THREAD STARTER               #5 (permalink)
New Member
Join Date: Mar 2004
Posts: 6
sarbz is an unknown quantity at this point
 



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?
Attached Images
File Type: gif screenshot.gif (4.3 KB, 2 views)
sarbz is offline  
Old 03-29-2004, 07:20 AM   #6 (permalink)
NamePros Member
Join Date: Nov 2003
Location: Ontario, Canada
Posts: 127
eagle12 will become famous soon enougheagle12 will become famous soon enough
 



Inside the form tag add

action="page you want it to go to"

and it should work.
eagle12 is offline  
Old 03-29-2004, 07:38 AM THREAD STARTER               #7 (permalink)
New Member
Join Date: Mar 2004
Posts: 6
sarbz is an unknown quantity at this point
 



still doesn't work


nope, it still doesn't go there. I get the same exact error as before.
sarbz is offline  
Old 03-29-2004, 07:46 AM   #8 (permalink)
NamePros Member
Join Date: Nov 2003
Location: Ontario, Canada
Posts: 127
eagle12 will become famous soon enougheagle12 will become famous soon enough
 



post up your code for the form
eagle12 is offline  
Old 03-29-2004, 08:03 PM THREAD STARTER               #9 (permalink)
New Member
Join Date: Mar 2004
Posts: 6
sarbz is an unknown quantity at this point
 



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>
sarbz is offline  
Old 03-30-2004, 10:28 AM   #10 (permalink)
NamePros Member
Join Date: Nov 2003
Location: Ontario, Canada
Posts: 127
eagle12 will become famous soon enougheagle12 will become famous soon enough
 



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.
eagle12 is offline  
Old 03-30-2004, 11:17 AM THREAD STARTER               #11 (permalink)
New Member
Join Date: Mar 2004
Posts: 6
sarbz is an unknown quantity at this point
 



Thank you! It's working now. Little by little I'm learning.

Thanks Again!
sarbz is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 07:43 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger