Forum: Ruby on Rails Issues With form_remote_tag

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
corey.mosher (Guest)
on 2005-11-12 12:50
(Received via mailing list)
Hi,
I'm trying to write my first rails application and I'm running into a
problem that I just can't seem to find the answer to.  I'm trying to
make each row on my list page editable.  So there's a form for each
row.  When I submit the form, my form values are not getting added to
the @params list.  This is what I have for my list.rhtml page (I
appologize for the formatting):

<html>
	<head>
		<title>Categories</title>
		<%= javascript_include_tag  :defaults %>
	</head>
	<body>

		<h1>Categories</h1>

		<div id="category_new">
			<h1>New</h1>
			<!--[form:category]-->
			<%= form_remote_tag :url => { :action => "create_ajax" },
  				:update=> "categories-list",
  				:position=> "bottom",
  				:effects => 'highlight',
  				:loading => "category.reset()",
  				:html=> { :id=>'category-form', :name=>'category' } %>

			<p>
  			<label for="category_name">Name</label><br />
  			<%= text_field 'category', 'name'  %>
			</p>

			<input type="submit" value="Create" />

			<%= end_form_tag %>
			<!--[eoform:category]-->
		</div>

		<table id="categories-list" class="categories-list">
		<% for category in @categories %>
  		<%= render_partial( 'category', category ) %>
		<% end %>
		</table>
	</body>
</html>

This is what I have for _category.rhtml:

<%= form_remote_tag :url => { :action => "update_ajax", :id =>
category.id },
				:update=> "categories-list",
  				:position=> "bottom",
  				:effects => 'highlight',
  				:html => { :id=>'category-form-#{category.id)',

:name=>'division_form_#{category.id)' }%>
<tr id="category-<%= category.id %>">
  <td>
    <%= text_field("category_#{category.id}", "name", "value" =>
category.name, "class" => "updateCatOn") %>
    <%= hidden_field("category_#{category.id}", "id", "value" =>
category.id) %>
  </td>
  <td><%= link_to 'Show', :action => 'show', :id => category.id %></td>
  <td><%= submit_tag("Update") %></td>
  <td><%= link_to 'Destroy', :action => 'destroy', :id => category.id
%></td>
</tr>
<%= end_form_tag %>
<% if controller.action_name == 'create_ajax' %>
<script>
   new Effect.Highlight('category-<%= category.id %>');
</script>
<% end %>
<% if controller.action_name == 'update_ajax' %>
<script>
   new Effect.Highlight('category-<%= category.id %>');
</script>
<% end %>

When I look at the log file I see that the following is what I have
for parameters:

Parameters: {"action"=>"update_ajax", "id"=>"1",
"controller"=>"category"}

Any help would be appreciated.

Thanks

--
Corey Mosher
This topic is locked and can not be replied to.