views:

21

answers:

2

I have 23(column)x6(row) table and change the row with link_to_remote function. each tr tag has its own id attribute.

change link call change action and change action changes the row using render function wit partial.

_change.html.erb

<td id="row_1">1</td>
.
.
omitted
.
.
<td id="row_23">23</td>

link_to_remote function

<%= link_to_remote 'Change', :update => 'row_1', :url => change_path %>

change action

def change
  logger.debug render :partial => 'change'
end

If I coded like above, everything work okay. This means all changed-columns are in one row.

But, if I wrap partial code with *form_for* function like below...

<% form_for 'change' do %>
<td id="row_1">1</td>
.
.
omitted
.
.
<td id="row_23">23</td>
<% end %>

Then, one column located in one row and that column is the first column. I've looked up the log file, but it was normal html tags.

What's wrong?

alt text

A: 

you have to use remote_form_for for the ajax form

<% remote_form_for 'change' do %>

instead of

<% form_for 'change' do %>
Salil
It does not work. here's screen capture of wrong result. http://www.flickr.com/photos/38742438@N05/4710821079/
Hongseok Yoon
It works find with IE8, and cause wrong result with Chrome. What's the problem?
Hongseok Yoon
A: 

Look at the HTML that's being generated. It's not valid to have td elements wrapped by form elements. Table cells have to be within table rows.

John Topley
then, are there any way to make editable row in table? that code worked normally if not a ajax style form.
Hongseok Yoon