Hi, I need to upload files in my application I am using following code <tr> <td width="125">Upload Document:</td><td width="400"><%form.file_field("filename") %></td> </tr> But I want that the file field that gets displayed in my browser should not be editable. i.e user should be able to select the file through the browse click only. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 19 Jun 2008, at 14:24, Sneha Ganvir wrote:> Hi, > I need to upload files in my application > I am using following code > > <tr> > <td width="125">Upload Document:</td><td width="400"><%> form.file_field("filename") %></td> > </tr> > > But I want that the file field that gets displayed in my browser > should > not be editable. > i.e user should be able to select the file through the browse click > only.The file field is implemented browser specifically, on Safari for example, there simply isn''t an editfield you can fill in. You can''t change this behavior. The only way it might possibly work is if you place a <div> input field and make sure the clicks don''t fall through (either using onclick="return false;" on the div or using unobtrusive javascript to do so). That said, make sure you check and adjust the placement of the <div> in all browsers and don''t show it on Safari. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Peter De Berdt wrote:> On 19 Jun 2008, at 14:24, Sneha Ganvir wrote: > >> should >> not be editable. >> i.e user should be able to select the file through the browse click >> only. > > The file field is implemented browser specifically, on Safari for > example, there simply isn''t an editfield you can fill in. You can''t > change this behavior. The only way it might possibly work is if you > place a <div> input field and make sure the clicks don''t fall through > (either using onclick="return false;" on the div or using unobtrusive > javascript to do so). That said, make sure you check and adjust the > placement of the <div> in all browsers and don''t show it on Safari. > > > Best regards > > Peter De BerdtBut atleast is it possible to handle i.e if the user is editing the wrong path an error message should get flashed But in my case whwtever path you mention it is getting saved. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---