js call with rails generated attributes (item ids)

Skip to first unread message

Claus Stachl

unread,
Apr 23, 2008, 6:34:02 AM4/23/08
to rubyonra...@googlegroups.com
hi. i want do call my js method "appear(box1, box2)" with rails created,
dynamic ids for my div tags -->

:complete => "appear('<%= dom_id(person.id)box %>','<%=
dom_id(person.id) %>')" %>

...unfortunatly, that doesn't work: syntax error, unexpected $end,
expecting ')' and so on.

how has the js call to look like? i hope u r able to help me.
here s the code snippet:


<% unless person.about == "" %>

<%= link_to_remote "mehr",
:url=>{:action => "showMore"},
:update => dom_id(person.id),
:complete => "appear('<%= dom_id(person.id)box %>','<%=
dom_id(person.id) %>')" %>

<% end %>

<div id="<%= dom_id(person.id) %>box">
<div id="<%= dom_id(person.id) %>"></div>
</div>
--
Posted via http://www.ruby-forum.com/.

Frederick Cheung

unread,
Apr 23, 2008, 6:39:32 AM4/23/08
to rubyonra...@googlegroups.com

On 23 Apr 2008, at 11:34, Claus Stachl wrote:

>
> hi. i want do call my js method "appear(box1, box2)" with rails
> created,
> dynamic ids for my div tags -->
>
> :complete => "appear('<%= dom_id(person.id)box %>','<%=
> dom_id(person.id) %>')" %>

that string is just a string (ie it's not put through erb)
"appear('#{dom_id(person.id)}box','#{dom_id(person.id)')"

should do the trick

Fred

Claus Stachl

unread,
Apr 23, 2008, 6:45:32 AM4/23/08
to rubyonra...@googlegroups.com

> "appear('#{dom_id(person.id)}box','#{dom_id(person.id)')"
>
> should do the trick


thanx a lot.

Claus Stachl

unread,
Apr 23, 2008, 8:52:53 AM4/23/08
to rubyonra...@googlegroups.com


sorry for disturbing again: now the produced html code is ok, but my
script isn't called. i use this script on an other site, thus i'm sure
the script is ok. can u think about a reason for that problem.

Frederick Cheung

unread,
Apr 23, 2008, 8:54:47 AM4/23/08
to rubyonra...@googlegroups.com

Use firebug to see what's going on (eg set a breakpoint in your appear
function).

Fred

Reply all
Reply to author
Forward
0 new messages