I want to change the look for all the buttons in my app. this includes the buttons generated by file_field_tag etc. where and how would i do this? changing the style of submit tags is easy enough but i''m struggling to get the file_field_tag''s button styled. will i have to override some action view code? any insight will be appreciated. -Francois
Hi Francois, I don''t believe you can easily style that. The file field button is not a separate HTML button element, it''s rendered by the browser as part of an HTML input tag of type "file". You could set styles for the entire file input, but you can''t affect the button by itself. However, it''s probably possible to do some javascript craziness to replace that button entirely. I haven''t tried it, but a quick googling gives this article on what is generally a very good site: http://www.quirksmode.org/dom/inputfile.html regards, Craig On Wed, 22 Jun 2005 5:46 pm, Francois Paul wrote:> I want to change the look for all the buttons in my app. > this includes the buttons generated by file_field_tag etc. > where and how would i do this? > > changing the style of submit tags is easy enough but i''m struggling to > get the file_field_tag''s button styled. > will i have to override some action view code? > > any insight will be appreciated. > > -Francois-- Craig Ambrose Web Elements http://www.portallus.com/people/craigambrose/
Thanks Craig, was hoping for a cleaner (non javascript and images) sollution, but it seams this is the only way to go. regards :francois Craig Ambrose wrote:>Hi Francois, > >I don''t believe you can easily style that. The file field button is not a >separate HTML button element, it''s rendered by the browser as part of an HTML >input tag of type "file". You could set styles for the entire file input, but >you can''t affect the button by itself. > >However, it''s probably possible to do some javascript craziness to replace >that button entirely. I haven''t tried it, but a quick googling gives this >article on what is generally a very good site: > >http://www.quirksmode.org/dom/inputfile.html > >regards, > >Craig > >On Wed, 22 Jun 2005 5:46 pm, Francois Paul wrote: > > >>I want to change the look for all the buttons in my app. >>this includes the buttons generated by file_field_tag etc. >>where and how would i do this? >> >>changing the style of submit tags is easy enough but i''m struggling to >>get the file_field_tag''s button styled. >>will i have to override some action view code? >> >>any insight will be appreciated. >> >>-Francois >> >> > > >
In CSS, try the following: input[type="submit"] { /* Styles you want to apply to submit button here */ } This is for CSS2 only (although I believe it works with IE6 as well as FireFox). You can also specify this style based on any tag attribute. Wayne -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Francois Paul Sent: Wednesday, 22 June 2005 6:44 PM To: craiga-aW5oDkNkUadaA94nB1n4cRCuuivNXqWP@public.gmane.org; rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] site-wide button css? Thanks Craig, was hoping for a cleaner (non javascript and images) sollution, but it seams this is the only way to go. regards :francois Craig Ambrose wrote:>Hi Francois, > >I don''t believe you can easily style that. The file field button is nota>separate HTML button element, it''s rendered by the browser as part ofan HTML>input tag of type "file". You could set styles for the entire fileinput, but>you can''t affect the button by itself. > >However, it''s probably possible to do some javascript craziness toreplace>that button entirely. I haven''t tried it, but a quick googling givesthis>article on what is generally a very good site: > >http://www.quirksmode.org/dom/inputfile.html > >regards, > >Craig > >On Wed, 22 Jun 2005 5:46 pm, Francois Paul wrote: > > >>I want to change the look for all the buttons in my app. >>this includes the buttons generated by file_field_tag etc. >>where and how would i do this? >> >>changing the style of submit tags is easy enough but i''m struggling to >>get the file_field_tag''s button styled. >>will i have to override some action view code? >> >>any insight will be appreciated. >> >>-Francois >> >> > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Craig Ambrose wrote:> http://www.quirksmode.org/dom/inputfile.htmlAs an aside from this, a while back when I was on the CSS-Discuss list [1] I remember a thread to do with the styling of file upload buttons. Back then it wasn''t considered possible (this Quirksmode page obviously hadn''t been written) and the reason was to do with the fact that browser vendors deliberately make it hard to disguise a file upload button as anything else, as a sort of security measure to protect unwary users from being tricked into uploading files. As for the input[type="submit"] suggestion offered by Wayne, I''m afraid that won''t work in IE6 or IE5.x because they don''t support attribute selectors. At the moment, if you want to cater for IE, you''re pretty much limited to using a superfluous class to accomplish something that could be done a much neater way with proper CSS2 support. With a little bit of luck, IE7 might have full CSS2 support but I''m not holding my breath just yet. [1] http://www.css-discuss.org/ Cheers, ~Dave -- Dave Silvester Rent-A-Monkey Website Development Web: http://www.rentamonkey.com/
> As for the input[type="submit"] suggestion offered by Wayne, I''m afraid that > won''t work in IE6 or IE5.x because they don''t support attribute selectors. At > the moment, if you want to cater for IE, you''re pretty much limited to using a > superfluous class to accomplish something that could be done a much neater way > with proper CSS2 support. > > With a little bit of luck, IE7 might have full CSS2 support but I''m not > holding my breath just yet.indeed, it does. http://dean.edwards.name/ie7/ ;-)
Tyler Kiley wrote:> indeed, it does. > http://dean.edwards.name/ie7/ > ;-)LOL!! Not *that* IE7, the other one! ;-) ~Dave -- Dave Silvester Rent-A-Monkey Website Development Web: http://www.rentamonkey.com/
That is a really cool project. I think I remember hearing about it before, but promptly forgot it. It sounds extremely handy. On 6/24/05, Tyler Kiley <tyler.kiley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > With a little bit of luck, IE7 might have full CSS2 support but I''m not > > holding my breath just yet. > > indeed, it does. > > http://dean.edwards.name/ie7/
On 22-jun-2005, at 9:46, Francois Paul wrote:> I want to change the look for all the buttons in my app. > this includes the buttons generated by file_field_tag etc. > where and how would i do this? > > changing the style of submit tags is easy enough but i''m struggling > to get the file_field_tag''s button styled. > will i have to override some action view code? > > any insight will be appreciated.Please don''t. Part of the magic of the file input (as I see it) that it is a native browser widget and users actually recognize it. I''ve seen (obscure and partial) support for window.onDragDrop event (but I wouldn''t dare to use that, also considering the security implications). -- Julian "Julik" Tarkhanov
On Jul 1, 2005, at 2:22 PM, Julian ''Julik'' Tarkhanov wrote:> > On 22-jun-2005, at 9:46, Francois Paul wrote: > > >> I want to change the look for all the buttons in my app. >> this includes the buttons generated by file_field_tag etc. >> where and how would i do this? >> >> changing the style of submit tags is easy enough but i''m >> struggling to get the file_field_tag''s button styled. >> will i have to override some action view code?As you can see in this thorough CSS lab, there''s only so much you can do, even if you are working directly with CSS and HTML: http://www.456bereastreet.com/archive/200409/styling_form_controls/ and http://www.456bereastreet.com/archive/200410/ styling_even_more_form_controls/ -Matt>> >> any insight will be appreciated. >> > > Please don''t. Part of the magic of the file input (as I see it) > that it is a native browser widget and users actually recognize it. > I''ve seen (obscure and partial) support for window.onDragDrop event > (but I wouldn''t dare to use that, also considering the security > implications). > > -- > Julian "Julik" Tarkhanov > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >Matt Pelletier pelletierm-A1PILTyJ15gXhy9q4Lf3Ug@public.gmane.org