Help with link_to_remote and RJS

Hi all -

New to rails, I have a page that contains a simple table for vendors,
with name a location fields. I'm trying to create an 'add vendor' link,
that adds a small to insert a new vendor on the fly. Here's what I have
in code:

# app/views/vendors/index.html.erb
<h1>Our Vendors</h1>
<div id="test_div"></div>
<%= link_to_remote 'add vendor', :url => { :action => 'new' } %>
  <tbody id="vendors-table">
    <tr id="vendors-headers">
    <%= render :partial => 'vendor', :collection => @vendors %>
# app/views/vendors/_vendor.html.erb
<% @vendor = vendor %>
<tr id="vendor_<%= %>">
  <td><%= %></td>
  <td><%= vendor.location %></td>
# app/views/_new_vendor.html.erb
  <% form_for :vendor, :url => { :action => 'create' } do |f| -%>
    <td><%= f.text_field :name, :size => 15 %></td>
    <td><%= f.text_field :location, :size => 15 %></td>
    <td><%= submit_tag 'save' %></td>
  <% end -%>
# app/controllers/vendors_controller.rb
class VendorsController < ApplicationController

  def index
    @vendors = Vendor.find(:all, :order => 'name')

  def new
    @vendor =
    respond_to do |format|
      format.html { render :partial => 'new_vendor', :object => }

  def create
    @vendor =[:vendor])
# app/views/vendors/new.js.rjs
page.insert_html :after, 'vendors-headers', :partial => 'new_vendor',
:object =>
I have a couple of issues. The first is that clicking the 'add vendor'
does add a table row with the form to the markup, but it doesn't show on
the page. I can see the page source adding the rows with the form
elements (in firebug), but it's as if the "display:none" is set on them
(no css is linked to the page, so that isn't it). I'm thinking it might
be because I'm not linking the form to the model properly, but I can't
see where I might be erring.

The other thing is I'm not sure how to complete the 'create' part so
that the new vendor is added properly to the table via rjs.

Any help will be awesome!

I don't think it's not legal markup. a <tr> tag may only contain <td> tags.