Guest User

Untitled

a guest
Feb 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. in the view:
  2. <% Candidate::RANKS.each do |rank| -%>
  3. <div class='form_row'>
  4. <div class='label'><%= h(rank.titlecase) %></div>
  5. <div class='item'><%= f.radio_button(:position_rank, rank) %></div>
  6. </div>
  7.  
  8. <%= observe_field("candidate_position_rank_#{rank}",
  9. :url => {
  10. :controller => 'faculty_search',
  11. :action => :rank_radio_button_changed,
  12. :id => rank},
  13. :with => "'radio_button_value=' + escape(value)",
  14. :on => "click") %>
  15. <% end -%>
  16.  
  17.  
  18. in the rjs:
  19.  
  20. if Candidate::JUNIOR_RANKS.include?(@radio_button_value)
  21. page << "alert('junior')"
  22. elsif Candidate::SENIOR_RANKS.include?(@radio_button_value)
  23. page << "alert('senior')"
  24. else
  25. # no op
  26. end
  27.  
  28. The problem:
  29. In the browser, the handler only gets fired the first time the thing is clicked.
Add Comment
Please, Sign In to add comment