Forum: Ruby on Rails css question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Craig W. (Guest)
on 2006-03-10 09:28
(Received via mailing list)
I'm doing this 'partial' to do some ajax auto_complete

<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>

and my understanding was that <span class="informal"> would make the
element inside 'hidden' but that isn't the case as it is visible.

so I added a class to the stylesheet the document is using...

.informal {
    visibility : hidden;
  }

and saved it but still the data inside is visible.

Is there something I am still missing?

Craig
Matthias von Rohr (Guest)
on 2006-03-10 10:11
(Received via mailing list)
> <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

Matt
Craig W. (Guest)
on 2006-03-10 16:16
(Received via mailing list)
On Fri, 2006-03-10 at 09:08 +0100, Matthias von Rohr wrote:
>
----
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
Craig W. (Guest)
on 2006-03-10 20:17
(Received via mailing list)
On Fri, 2006-03-10 at 07:10 -0700, Craig W. 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
This topic is locked and can not be replied to.