<% end %>
<% if @issue.safe_attribute?('category_id') && @issue.project.issue_categories.any? %>
-<p><%= f.select :category_id, (@issue.project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true, :required => @issue.required_attribute?('category_id') %>
+<p><%= f.select :category_id, (@issue.project.issue_categories.collect {|c| [c.name, c.id]}), {:include_blank => true, :required => @issue.required_attribute?('category_id')}, :onchange => ("updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" if @issue.new_record?) %>
<%= link_to(l(:label_issue_category_new),
new_project_issue_category_path(@issue.project),
:remote => true,
replaceIssueFormWith('<%= escape_javascript(render :partial => 'form') %>');
-<% if params[:form_update_triggered_by] == "issue_project_id" %>
-$("#watchers_form_container").html('<%= escape_javascript(render :partial => 'issues/watchers_form') %>');
+<% case params[:form_update_triggered_by] %>
+<% when "issue_project_id" %>
+ $("#watchers_form_container").html('<%= escape_javascript(render :partial => 'issues/watchers_form') %>');
+<% when "issue_category_id" %>
+ <% if @issue.assigned_to_id.blank? %>
+ $('#issue_assigned_to_id').val('<%= @issue.category.try(:assigned_to_id) %>');
+ <% end %>
<% end %>