Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Problem is that cli_tag never spits the option with the proper value selected...
- def cpp_select_tags
- prg_tag = ""
- prj_tag = ""
- client_id = nil
- project_id = nil
- program_id = nil
- client_id = params[:cpp_cli][:client_id] if params[:cpp_cli] and params[:cpp_cli][:client_id]
- project_id = params[:cpp_prj][:project_id] if params[:cpp_prj] and params[:cpp_prj][:project_id]
- program_id = params[:cpp_prg][:program_id] if params[:cpp_prg] and params[:cpp_prg][:program_id]
- options = {:include_blank => true}
- html_options = {:onchange => "document.forms[0].submit()"}
- local_html_options = html_options; local_html_options.store(:selected,client_id)
- cli_tag = select("cpp_cli", "client_id", Client.find(:all).collect {|p| [ p.name, p.id ] }, options, local_html_options )
- if (client_id)
- prj_tag = select("cpp_prj", "project_id", Project.find(:all, :conditions => [ "client_id = ?", client_id ]).collect {|p| [ p.name, p.id ] }, options, html_options )
- if (project_id)
- prg_tag = select("cpp_prg", "program_id", Program.find(:all, :conditions => [ "project_id = ?", project_id ]).collect {|p| [ p.name, p.id ] }, options, html_options )
- end
- end
- auth_ht = "<input type=hidden name=authenticity_token value=#{form_authenticity_token}>\n"
- cli_tag << "\n<br/>" << prj_tag << "\n<br/>" << prg_tag << "\n<br/>" << auth_ht << "\n"
- end
Add Comment
Please, Sign In to add comment