Hello, I have a page where, once the user enters it, I want to disable some buttons. This because the user must select a row for them to be accessible. To be more specific, they are edit/delete buttons. So, basically, I want them disabled if there is no row in selected in the table. My problem is that I don''t know the proper component to use. This is the way I''m trying right now: <%= link_to image_submit_tag("btn_delete.png", :id => "btn_delete", :title => "Delete report", :class => "btn_delete", :disabled => true), :action => "verify_availability" %> The verify_availability method is in reports controller, and it verifies if the user is able to delete that report. This will create an HTML anchor with an input type="image" inside. This creates another problem: :disabled => true doesn''t work on IE (and only on IE). So, is there a workaround for this issue? Thanks for your time. -- Posted via http://www.ruby-forum.com/.
Hi Eduardo, On Wed, 2009-10-21 at 13:51 +0200, Eduardo Bueno wrote:> My problem is that I don''t know the proper component to use. This is the > way I''m trying right now: > > <%= link_to image_submit_tag> This creates another problem: > :disabled => true doesn''t work on IE (and only on IE)Maybe it''s just too early here, but I''m not following you. For starters, why are you using _both_ link_to and image_submit_tag ? It''s kind of interesting that it''s working at all. I''d see if the HTML being generated (using Firefox, of course) validates. Assuming that the buttons you want to disable are, in fact, form submit buttons, I''d lose the ''link_to'' as a first step. Let us know what the behavior is when you do that. HTH, Bill
bill walton wrote:> Hi Eduardo, > > Maybe it''s just too early here, but I''m not following you. For > starters, why are you using _both_ link_to and image_submit_tag ? > > It''s kind of interesting that it''s working at all. I''d see if the HTML > being generated (using Firefox, of course) validates. > > Assuming that the buttons you want to disable are, in fact, form submit > buttons, I''d lose the ''link_to'' as a first step. Let us know what the > behavior is when you do that. > > HTH, > BillI''m using link_to with image_submit_tag justly to avoid using a form. People often use link_to with image_tag for image links, and since both HTML anchors and imgs can''t be disabled, I thought of using that. Note that I''m a starter too, and if this is not the better approach please let me know. -- Posted via http://www.ruby-forum.com/.
> I''m using link_to with image_submit_tag justly to avoid using a form. > People often use link_to with image_tag for image links, and since both > HTML anchors and imgs can''t be disabled, I thought of using that. Note > that I''m a starter too, and if this is not the better approach please > let me know.I''m not sure if this will help, but here is the url to all the link rails helpers, one of them is a link_to_if which creates a link if a condition is met. http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html Not sure if this helps at all, but it might be useful to create a link IF a row is select and do something else if it is not. Also, it looks like you can have the "disabled" attribute for a link but I was unable to locate an example of it in use but I would imagine it would an html_option. -- Posted via http://www.ruby-forum.com/.