• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Retain File Selected in a File Upload Component

 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using a File Upload Component to allow users to browse to the file, and choose one. I do not want to upload the file but just get the File Path.
I am able to do this without any problem.
However, there are value change events that cause form submit and if the user selected/chose the file before these events then the value is lost.
I want to retain the chosen file path in the Upload component even after form submits caused by value change events.Is there any way to handle this?
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found my answer while going through posts!

Problem with t:inputFileUpload

Seems Like I will have to invest the time in a creating a custom File Chooser Component (Similar to one in Swing) !
[ November 14, 2008: Message edited by: Kavita Tipnis ]
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After pondering on how to implement a file chooser component, I came up with a work around and I feel like sharing it with all the ranchers!
Problem - Choosing a file path,saving only the path and no file upload, any other form submit (such as value change) would cause the upload component(Tomahawk,Richfaces woodstock...)to lose it's value causing user annoyance!
Solution/Work Around - I created the file upload component in another jsf page and on submitting that page I take the value of the Uploaded File and put it on the required page.

Here is the code



This will work for any file upload component , I have used Woodstock.
This was useful to me, it may not be a good way to do it or developers might be doing it in some efficient way!
But It works!
Note : I tried putting the javascript(to open the pop up) in an external file, it works but never sets focus to the new window(problem occurs in IE!!). Any insight on this would be great !

(onkclick - because I could not type 'C'!!)
 
reply
    Bookmark Topic Watch Topic
  • New Topic