Guest User

Untitled

a guest
Jun 21st, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <%= f.check_box :foobar, :onchange => "
  2. if(this.checked==true) {
  3. $('binding_pp').visualEffect('Appear');
  4. Element.update('phone_number_select', '#{render :partial => \"foobar1\"}')
  5. } else {
  6. $('binding_pp').visualEffect('Fade');
  7. Element.update('phone_number_select', '#{render :partial => \"foobar2\"}')
  8. }
  9. " %>
  10.  
  11. # foobar1 and foobar2 both render something like
  12.  
  13. f.select :phone_number, ....
  14.  
  15. # but with different options. I cannot use display:none CSS
  16. # because then there would be two "phone_number" objects
  17. # in the submitted form data, even if one is invisible, and
  18. # this would cause wrong data to be submitted (potentially).
Add Comment
Please, Sign In to add comment