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 %>
}

</script>

<body onload="javascript:onloadd()">

 <original form goes here.......>

</body>
-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to