observe_field

Hi.... I'm trying to update the content in a div while the value of a hidden field is changed.

<%= hidden_field "location", "id", "value" => 0 %>

<%= observe_field("location_id",    :update => "ci_location_container",    :url => { :controller => :ci, :action => :choose_ci_location_ui },    :method => "post",    :with => "'location_id='+value") %>

There is no response. But when I replaced the hidden_field with a select, it worked. I need to implement the observe_field with hidden_field itself. Please help me....

When you test this... is the request going out how are you changing the hidden field?

Keynan Pratt wrote:

When you test this... is the request going out how are you changing the hidden field?

There is a link called choose location. When I click on it, a popup box for selecting the location is shown. When I click on one location, the value of the hidden field will be changed. The code for changing the value of the hidden_field is given below:

In the view search_ci_location.rhtml under popup controller: <script type="text/javascript"> function setLocation(location_id) {   window.opener.document.forms[0].location_id.value=location_id;   window.close() } </script>

<a href="javascript:setLocation(<%= location.location_id%>);"><%= location.street %></a>

I don't think that will trigger correctly. Can't you add an Ajax request to the setLocation function directly?

brewpoo wrote:

I don't think that will trigger correctly. Can't you add an Ajax request to the setLocation function directly?

On Jan 21, 4:52 am, Suneeta Km <rails-mailing-l...@andreas-s.net>

Can u please show me an example of how to do this?