<% user_id = params[:user_id] || @user_id %>
<% display_name = User.find_by_id(user_id).display_name %>

<h2>Send a new message to <%= h(display_name) %></h2>

<% if params[:display_name] %>
<p>Writing a new message to <%= h(params[:display_name]) %></p>  
<p>TODO: drop down box of your friends</p>
<%end%>

<%= error_messages_for 'message' %>

<% form_for :message, :url => { :action => "new", :user_id => user_id } do |f| %>
  <table>
    <tr valign="top">
      <th>Subject</th>
      <td><%= f.text_field :title, :size => 60, :value => @title %></td>
    </tr>
    <tr valign="top">
      <th>Body</th>
      <td><%= f.text_area :body, :cols => 80, :value => @body %></td>
    </tr>
    <tr>
      <th></th>
      <td><%= submit_tag 'Send', :action => 'new' %></td>
    </tr>
  </table>
<% end %>

<br />

<%= link_to 'Back to inbox', :controller => 'message', :action => 'inbox', :display_name => @user.display_name %>

<% user_id = params[:user_id] || @user_id %>
<% display_name = User.find_by_id(user_id).display_name %>

<h2>Send a new message to <%= h(display_name) %></h2>

<% if params[:display_name] %>
<p>Writing a new message to <%= h(params[:display_name]) %></p>  
<p>TODO: drop down box of your friends</p>
<%end%>

<%= error_messages_for 'message' %>

<% form_for :message, :url => { :action => "new", :user_id => user_id } do |f| %>
  <table>
    <tr valign="top">
      <th>Subject</th>
      <td><%= f.text_field :title, :size => 60, :value => @title %></td>
    </tr>
    <tr valign="top">
      <th>Body</th>
      <td><%= f.text_area :body, :cols => 80, :value => @body %></td>
    </tr>
    <tr>
      <th></th>
      <td><%= submit_tag 'Send' %></td>
    </tr>
  </table>
<% end %>

<br />

<%= link_to 'Back to inbox', :controller => 'message', :action => 'inbox', :display_name => @user.display_name %>

Remove bogus action attribute from the submit button - it should have no effect as there is no such attribute defined, but Opera seems to decide that it should post the form to that URL instead of the one give on the form element.
Remove bogus action attribute from the submit button - it should have
no effect as there is no such attribute defined, but Opera seems to
decide that it should post the form to that URL instead of the one
give on the form element.


