Hi All,
I'm having an issue with rails involving javascript. Basically, I have the following code:
<ul id="all-points">
<%for point in Point.find(:all)%>
<%domid = "point[all][#{point.id}]"%>
<li class="available-point" id='<%=domid%>'>
<span>
<%= link_to_remote "ADD",:url => {:action => "add_point"},
:html => {:style => "background: wheat; color: gray; text-decoration: none; border: 1px solid gray;"},
:with => "'point=' + #{domid}"
%>
</span>
(<%=point.source%>)   <%=point.name%>
</li>
<%= draggable_element(domid, :ghosting => true, :revert => true, :scroll => "window")%>
<%end%>
</ul>
However, I keep receiving RJS errors telling me "Can't find variable: point". The error has something to do with DOMID as when I change the word "point" to "alksdjflksdjfls" (a.k.a. garbage), it warns me about the garbage name. I'm admittedly rusty when it comes to Javascript, but this error doesn't seem to give enough info. Can someone please tell me what is wrong with my code?
FYI, the error comes in my controller when I say:
def add_point
render :update do |page|
page.insert_html :bottom, "selected-points", "<li>test phrase</li>"
page.remove params[:point] #error occurs here
end
end
I've tried encodeURIComponent as well, but nothing seems to matter. Also, I'm using both Safari and Firefox to debug. Thoughts?
Best.