Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to disable Rails submit buttons alongside Prototype helpers & RJS?
    text
    copied!<p>I'm trying to follow this post <a href="https://stackoverflow.com/questions/576240/how-can-i-unobtrusively-disable-submit-buttons-with-javascript-and-prototype">How can I unobtrusively disable submit buttons with Javascript and Prototype?</a> but I can't get it to work. The form triggers an RJS function, so I need to keep the helpers' onclick events intact. The RJS returns/reloads the same forms along with two new texts. I'm really confused. Here is my rails code for the forms:</p> <pre><code>.span-20#comparison / new comparison . . . / voting forms (also reloaded) .span-4.prepend-3.append-6 - form_remote_tag :action =&gt; url_for(:controller =&gt; :comparisons), :method =&gt; :post do = hidden_field_tag :poem1_id, poems[:a].id = hidden_field_tag :poem2_id, poems[:b].id = hidden_field_tag :response, 1 = submit_tag "Vote for me", :disabled =&gt; false, :disable_with =&gt; 'Vote for me', :class =&gt; "compare" .span-4.append-3.last - form_remote_tag :action =&gt; url_for(:controller =&gt; :comparisons), :method =&gt; :post do = hidden_field_tag :poem1_id, poems[:a].id = hidden_field_tag :poem2_id, poems[:b].id = hidden_field_tag :response, 2 = submit_tag "Vote for me", :disable_with =&gt; 'Vote for me', :class =&gt; "compare" .span-4.prepend-8.append-8.prepend-top.last - form_remote_tag :action =&gt; url_for(:controller =&gt; :comparisons), :method =&gt; :post do = hidden_field_tag :poem1_id, poems[:a].id = hidden_field_tag :poem2_id, poems[:b].id = hidden_field_tag :response, 'draw' = submit_tag "Declare Draw", :disable_with =&gt; 'Declare Draw', :class =&gt; "compare" </code></pre> <p>RJS</p> <pre><code>page.replace_html :comparison, :partial =&gt; 'poems', :object =&gt; @poems page.insert_html :top, :previous, :partial =&gt; 'comparison', :object =&gt; @comparison page &lt;&lt; "Effect.ScrollTo($('top'));" </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload