[Rails] Re: Beginners question | moving a method from controller to model

2011-05-08 Thread Ruby Tuesday
Jeffrey L. Taylor wrote in post #997405: > See inserted comments below. > > Quoting linda Keating : >> new_capacity = event.capacity >> format.xml { render :xml => @line_item, :status => :created, >> >> > new_capacity and event are local variables in the controller method. > They are

[Rails] Re: beginners question

2009-03-01 Thread Gavin
Ruud - I hope you don't mind but I emailed you some material on the Prototype and Scriptaculous libraries. Might be in your junk mail box? On Feb 28, 9:18 pm, ruud wrote: > Hi Gavin, > > I tried your suggestion; this time the javascript function isn't > called at all. > >              <% form

[Rails] Re: beginners question

2009-02-28 Thread ruud
Hi Gavin, I tried your suggestion; this time the javascript function isn't called at all. <% form_tag({}, {:id => 'radioform'}) do %> <%= radio_button_tag( 'datum', 'geen', @geendatum ) %> <%= f.label( 'geen datum' ) %> <%= radio_butt

[Rails] Re: beginners question

2009-02-27 Thread Gavin
If observe_field isn't going to call more than once, but you could try observe_form instead? <%= observe_form :new_item, :function => 'datum_geklikt()' %> I know it's not ideal but instead of passing arguments true and false to the function, have the function determine the current value of the r

[Rails] Re: beginners question

2009-02-27 Thread ruud
On Feb 27, 7:23 pm, Gavin wrote: > what do you have in the date_clicked() function now? Hi Gavin, I had the same idea: function datum_geklikt (geenDatum) { var doc = window.content.document; alert('jep'); doc.getElementById( 'dagid').disabled = geenDatum; doc.getElementById

[Rails] Re: beginners question

2009-02-27 Thread Gavin
Hi Ruud Hmm - I've never used observe_field to call a js function, usually just for rails-ajax calls. If I were calling a js function like so, I'd normally just add :onclick => 'date_clicked(true)' to the radio buttons. There should be a way to call the js function using observe_field though

[Rails] Re: beginners question

2009-02-27 Thread ruud
hi Gavin, I inserted two observe_field calls, essentially replacing the onclick values on the radio button tags. But it turns out that only the first time a radio button is clicked, the :function of the observer is called. So if I switch back, nothing happens. It does if I reload the page. Do I m

[Rails] Re: beginners question

2009-02-26 Thread ruud
On 26 feb, 15:33, Gavin wrote: > The JS function you've given seems fine to though and for such a > simple operation, I'd probably just go with that. > By including  <%= javascript_include_tag :defaults %> you'll also have > access to the application.js file in your public/javascripts dir. > Y

[Rails] Re: beginners question

2009-02-26 Thread Gavin
Hey ruud- You could attempt this using ajax in an effort to keep things neater. If you add <%= javascript_include_tag :defaults %> to your views then rails will also load up the prototype library. This gives access to loads of helpful js and ajax functions. http://api.rubyonrails.org/ - rea