On Fri, 2006-03-10 at 07:10 -0700, Craig White wrote:
One more time at this because someone knows the answer to this and I''m
not getting it.
using text_field_with_auto_complete
It searches db fine, returns with list of 2 related
columns...clwholename and id
It returns to the calling form by way of a partial that has 2 <div> but
separate class names (see below for actual code)
Both values return to web app and can be seen inside same <li> (via DOM
inspector) as separate <div> with their respective NodeValues and text
values (the part I want).
But when the form is POSTed, I get the value from
<%= text_field_with_auto_complete :placement, :clwholename, {} %>
But not from
<%= hidden_field ''placement'', ''id'' %>
or
<%= hidden_field :placement, :id %>
In essence, I want the ''id'' from the auto_complete selection
to tag
along with the post so I don''t have to look it up again afterwards
because that is too painful.
Craig
> On Fri, 2006-03-10 at 09:08 +0100, Matthias von Rohr wrote:
> > > <ul class="placements">
> > > <% for client in @clients do -%>
> > > <li class="placements">
> > > <div class="clwholename"><%=h
client.clwholename %></div>
> > > <div class="id><span
class="informal"><%= client.id
%></span></div></li>
> > > <% end -%>
> > > </ul>
> > >
> > You are missing a parenthesis in the ''<div class="id
'' tag after the
> > "id" property
> >
> ----
> duh - good catch...interesting that it worked at all. In fact, fixing it
> breaks it and I think I can finally ask an intelligent question about
> this.
>
> I am returning client.id to my form (whether visible or not is probably
> not meaningful at the moment).
>
> I want to submit this value obtained via ajax/auto_complete with my
> post.
>
> If I add
> <%= hidden_field ''placement'',''id''
%>
> immediately after
> <%= text_field_with_auto_complete :placement, :clwholename, {} %>
>
> the POST includes
>
> Processing PlacementsController#findresult (for 127.0.0.1 at 2006-03-10
> 06:53:14) [POST]
> Parameters: {"commit"=>"Find",
"action"=>"findresult",
> "controller"=>"placements",
"placement"=>{"id"=>"",
> "beg_referral_date"=>"",
"clwholename"=>"George Washington"}}
>
> so the value returned is blank for ''id'' but clearly there
for
> ''clwholename''
>
> Obviously this ''id'' value is returning to the form via
autocomplete, I
> can see it there both on screen (until I set css invisible) and in DOM
> inspector where it shows up as a <div> with node_value of
"id" just
> below the <div> with node_value of "clwholename" but I need
that value
> returned when I ''POST'' the form.
>
> any clues?
>
> Craig
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails