I got a submit_to_remote button that I’d like to show as disabled on a
certain condition. I’d assume the usual :disabled => true would do but I
have not been able to. Comparing page source shows that for example:
<%= submit_to_remote “add”, “Add”, :url => { :action => “add_groups” },
:update => ‘divgrouptable’, :disabled => true %>
the “:disabled = true” statement has no effect on the generated html.
Also tried “{ :disabled => true }” and a few others.
I went as far as writing on-load hook and disabling the buttons in the
java script as shown below but sounds like a lot of effort to achieve
this. How could I make this less “obtrusive”?
function disable_buttons()
{
<% if @readonly %>
document.getElementsByName(‘add’)[0].disabled = 1
document.getElementsByName(‘remove’)[0].disabled = 1
<% end %>
}