Alex Reuter <reuter@...> writes:
>
> I''m having trouble getting observe_field to work properly.
Specifically the
> method on the server gets called, but the specified div does not update.
>
> Here is my rhtml:
>
> <form action="/chapter/new_milestone">
>
> <tr>
> <td>
> <select id="milestone_type_id"
name="milestone_type_id">
> <option></option>
> <% <at> remaining_milestones.each do |milestone_type| %>
> <option value="<%=milestone_type.id%>"><%
> =milestone_type.name%></option>
> <% end %>
> </select>
> <%= observe_field(''milestone_type_id'',
> :update=>"milestonedata",
> :url => { :action => :update_milestone_data },
> :with => "''milestone_type_id='' + escape
> (value)") %>
>
> </td>
> </tr>
> <div id="milestonedata"></div>
> </form>
Ok - solved my own problem here, and not surprisingly the issue was the html
itself. My html education stopped at table/tr/td and it seems that I was
doing something wrong. I''m guessing the tables and divs don''t
play the way I
thought they did. To ''fix'' it I removed all extraneous code
and this:
<div id="milestonedata"></div>
<form action="/chapter/new_milestone">
<select id="milestone_type_id"
name="milestone_type_id">
<option></option>
<% @remaining_milestones.each do |milestone_type| %>
<option value="<%=milestone_type.id%>"><%
=milestone_type.name%></option>
<% end %>
</select>
<%= observe_field(''milestone_type_id'',
:update=>''milestonedata'',
:url => { :action => :update_milestone_data },
:with => "''milestone_type_id='' + escape
(value)") %>
</form>
works just fine.
If anyone wants to point out what was wrong with my original html, by all
means do so. Either way I think I am in for some html re-education.