Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

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 Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old May 15th, 2004, 02:46 PM
geoffspruce geoffspruce is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 10 geoffspruce User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Javascrript help

Could someone please tell me how to obtain the Value of the file/browse box on an HTML form using Javascript. (or any form field for that matter.)

Any help appreciated. Whilst my PHP is ok my Javasript is sadly lacking so keep it simple.

Cheers

Reply With Quote
  #2  
Old May 15th, 2004, 05:50 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: Javascrript help

all you need to do is reference the value of the form field like so.

document.formname.fieldname.value

and assign it to a variable. The following example will show a popup alert of the field value of the input file type when you click the submit button.

<form method="post" name="form1">
<input type="file" enctype="multipart/form-data" name="file" />
<input type="submit" name="submit" value="Submit" onclick="alert(document.form1.file.value);return false;"/>
</form>

note the return false is there to actually prevent the form from being submitted for this example. If you put this code in a page and then browse for a file, then click the submit button, the popup will show the file selected. This method can be used for any form field.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > Javascrript help


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