disabled button

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.

Hi Eduardo,

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, Bill

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.