Hi Rails Developers

I want to create addEventListener to button. I have two method like def work_sheet_csv     summary = [       "site_name=#{}",       "site_code=#{}",       "year=#{current_project.index_code_year}",       '%s=%s' % [current_project.week? ? 'week' : 'month', current_project.index_code_suffix],       "day_count=#{current_project.days}",       "staff_count=#{current_project.t_project_staffs.length}",     ]

    header = %w(       number staff_last_name staff_first_name staff_code year month day       shift_name kyuka from_jikoku to_jikoku jitsudo_minutes location_name     )

    io =

    CSV::Writer.generate(io) do |csv|       csv << summary << header

      cells = TProjectWorkSheetCell.structured_data(, current_project)

      XProjectShiftXLocation.append_to(current_project.t_project_shifts, current_project.t_project_locations)       shifts_hash = current_project.t_project_shifts.inject({}) {|h, r| h[] = r; h }

      number = 0

      current_project.t_project_staffs.sort.each do |t_project_staff|         current_project.days.times do |date_index|           date = current_project.date_by_date_index(date_index)

          shift = nil           shift_name =             if cell = cells[date_index][]               if cell.fixed?                 shift = shifts_hash[cell.shift_ids.first]                 shift && shift.display_name               elsif cell.only?                 _('Only-Shift')               elsif cell.except?                 _('Except-Shift')               else                 nil               end             else               nil             end

          csv << [             number += 1,             t_project_staff.last_name,             t_project_staff.first_name,             t_project_staff.staff_code,             date.year,             date.month,   ,             shift_name,             shift && shift.kyuka ? 1 : 0,             shift && shift.formatted_from_jikoku,             shift && shift.formatted_to_jikoku,             shift && shift.jitsudo_minutes,             shift && shift.location &&,           ]         end       end     end

    io.rewind     send_data NKF.nkf('-Ws',, :filename => NKF.nkf('-Ws', work_sheet_csv_filename)   end


def index     @plugin_root = get_plugin_root     @templates_array = get_templates "#{get_plugin_root}/public/converter/templates/"   end

  def generate_excel

    template_path = "#{get_plugin_root}/public/converter/templates/#{params[:template]}"     output_path = "#{RAILS_ROOT}/public/converter/output/#{params[:output]}.xml"

    puts "==========="     puts template_path     puts output_path

    #converter_generate(sheet_id, from_date, output_path=OUTPUT_PATH, template_path=TEMPLATE_PATH)     converter_generate(params[:sheet_id], params[:date], output_path, template_path)

end def get_templates(templates_path)     dir =     templates =     dir.each do |d|       templates << File.basename(d.gsub(/\\/, '/'), '.xml') unless (d=~/^\./) #except hidden files       templates.sort!     end     templates   end

second method gets parameters from select_tag, and add it to converter_generate

I want to create select_tag like

<select id="temp" name="template"><option value=temp1>temp1</option> <option value=temp2>temp2</option> <option value=temp3>temp3</option> <option value=temp41>temp4</option> <option value=csv>csv</option></select>

and when I select template I want to run converter_generate with that template but when I select csv want to run work_sheet_csv.

thanks for any help..