Я хочу загрузить модальное диалоговое окно, нажав кнопку Отправить тег.но когда я нажимаю на кнопку, она сразу переходит на страницу, не переходя в файл rjs, и не отображается частично.мой код:
<span style="text-align: right">
<% form_tag "/calendar/dia_cal_view" do %>
<%= collection_select("event", "trainer_id", @trainers , :id, :name, {:prompt => true}) %>
<%= submit_tag "search" %>
<%end%>
</span>
код контроллера:
def dia_cal_view
@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[:dia_Serach].nil?
if (defined? (params[:event][:trainer_id]))
session[:dia_Serach]=(params[:event][:trainer_id])
#@@id=(params[:event][:trainer_id])
@event_strips = Event.event_strips_for_month(@shown_month, @first_day_of_week, :conditions=>["trainer_id = ?",session[:dia_Serach]])
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=>["trainer_id = ?",session[:dia_Serach]])
end
end
dia_cal_view.js.rjs
page.replace_html 'search_result', :partial => 'cal_view'
page<< "$j ('#search_result_dialog').dialog({
title: 'calendar',
modal: true,
width: 500,
height: 500,
close: function(event, ui) { $j ('#search_result_dialog').dialog('destroy') }
});"
_cal_view.html.erb
<%= stylesheet_link_tag "event_calendar" %>
<%= event_calendar %>
Проблема в том, что файл rjs не работает.Это не пошло в файл rjs.что я должен сделать для этого?Пожалуйста, помогите мне ..