Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 4th, 2006, 05:21 AM
Authorized User
Join Date: Oct 2006
Location: Bangalore, Karnataka, India.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default setting the value of a file object

I have a control on me screen of type <FILE>. I want to set some value to that object from the database. I tried the following code using html.

<html >
<script type="text/javascript">
function fun()

<input type="file" value="hello" id="j" />
<input type="button" onclick="alert(document.getElementById('j').value) ;"
<input type="button" onclick="fun();"
but none of the above showed proper values for alert. it was showing null.

If I'm entering some values into the file field manalyy then proper alert is coming.
If I change the file type to text, then it is setting the value in the textfield with the value in the value attribute.

So my question is how to I set the value into the <FILE> type through the code implicitly.

Reply With Quote
  #2 (permalink)  
Old November 4th, 2006, 05:38 AM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Hi there,

AFAIK, this can't be done. And I am glad you can't.... ;)

Check out my post in this thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=13884 to see what I mean....

Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #3 (permalink)  
Old November 6th, 2006, 10:10 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts

BTW, please don't cross post to multiple forums, once is enough.
Other thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=51855


Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Default values when setting up an object data sour mikener ASP.NET 2.0 Professional 0 November 3rd, 2008 09:12 AM
Setting of web config file epkgupta General .NET 0 July 9th, 2008 09:32 AM
setting the value of a file object swarnap Javascript How-To 3 November 6th, 2006 11:13 AM
Setting stylesheet for dynamically created object tgopal Javascript 2 September 6th, 2004 11:47 PM
File security setting wwshi Classic ASP Basics 0 March 30th, 2004 10:20 PM

All times are GMT -4. The time now is 12:23 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.