Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use "observe_field" in JQuery model dialog box on rails 2.3.8?
    primarykey
    data
    text
    <p>I'm developing project on rails 2.3.8 and I need to use observe_field in model dialog box but it didn't work for me. Is it possible to use "observe_field" on model dialog box? Please can some one explain me how to use this on model dialog box ? This how I use observe filed</p> <pre><code>&lt;%= collection_select("event", "trainer_id", @trainers , :id, :name, {:prompt =&gt; true}) %&gt; &lt;%= link_to_remote 'Show calendar', :url =&gt; {:controller =&gt; 'calendar', :action =&gt; 'dynamicTrainer'} %&gt; &lt;%= observe_field 'event', :url =&gt; {:controller =&gt; 'calendar', :action=&gt; 'dynamicTr'}, :with =&gt; "'mypara=' + escape(value)" %&gt; </code></pre> <p>This is dynamicTr method in calendar controller.</p> <pre><code>def dynamicTr if (defined? (params[:trainer_id])) session[:my123] = 'defined' else session[:my123] = 'not' end end def dynamicTrainer session[:mySerach]=params[:mypara] @month = (params[:month] || (Time.zone || Time).now.month).to_i @year = (params[:year] || (Time.zone || Time).now.year).to_i @shown_month = Date.civil(@year, @month) @trainers=Trainer.all @first_day_of_week = 1 if session[:mySerach].nil? if (defined? (params[:mypara])) session[:mySerach]=(params[:mypara]) #@@id=(params[:event][:trainer_id]) @event_strips = Event.event_strips_for_month(@shown_month, @first_day_of_week, :conditions=&gt;["trainer_id = ?",session[:mySerach]]) else @event_strips = Event.event_strips_for_month(@shown_month, @first_day_of_week) end else @event_strips = Event.event_strips_for_month(@shown_month, @first_day_of_week, :conditions=&gt;["trainer_id = ?",session[:mySerach]]) end end </code></pre> <p>And this is my dynamicTrainer.js.rjs file</p> <pre><code>page.replace_html 'show_cal', :partial =&gt; 'dynamicTr' page&lt;&lt; "$j ('#show_cal_dialog').dialog({ title: 'calendar', modal: true, width: 500, height: 500, close: function(event, ui) { $j ('#show_cal_dialog').dialog('destroy') } });" </code></pre> <p>This is dynamicTr partial code</p> <pre><code>&lt;%= stylesheet_link_tag "event_calendar" %&gt; &lt;%= event_calendar%&gt; &lt;%= session[:my123]%&gt; </code></pre> <p>problem is it shows the calendar but it doesn't print the session values. Can't I use observe_field on model dialog box ? Please can someone explain me the problem here.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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