Js call with rails generated attributes (item ids)

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

On 23 Apr 2008, at 11:34, Claus S. 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

“appear(’#{dom_id(person.id)}box’,’#{dom_id(person.id)’)”

should do the trick

thanx a lot.

Frederick C. wrote:

On 23 Apr 2008, at 11:34, Claus S. 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

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.

On 23 Apr 2008, at 13:52, Claus S. wrote:

dom_id(person.id) %>’)" %>
sure
the script is ok. can u think about a reason for that problem.

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

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs