How to update a single table cell using ajax

I’m trying to update a table cell based upon a selection in another cell
identified as “descPlaceholder”. However, instead of getting the
intended cell updated the updated string gets displayed completely
outside of the table in a seemingly arbitrary spot on the form.

The form:

Code Name Quantity
<%= select_tag :partcode, options_from_collection_for_select(@parts, 'id', 'code') %> <%= observe_field(:partcode, :update => :descPlaceholder, :url => {:action => :getPartName}) %> placeholder for description <%= text_field "partquantity", "quantity", :size =>5, :maxlength =>5 %>

getPartName.html.erb:

Test Description

getPartName method:
def
end

On Wed, Jul 28, 2010 at 8:30 AM, Tomasz R.
[email protected] wrote:

I’m trying to update a table cell based upon a selection in another cell
identified as “descPlaceholder”. However, instead of getting the
intended cell updated the updated string gets displayed completely
outside of the table in a seemingly arbitrary spot on the form.

 </td>
 <div id="descPlaceholder">
   <td>placeholder for description</td>
 </div>
 <td>

That’ll never work because it’s not valid HTML; a DIV can’t be a child
of a TR.


Hassan S. ------------------------ [email protected]
twitter: @hassan

You can alwaus just do the following:

Eric Y. wrote:

You can alwaus just do the following:

Wow, many thanks to both of you!