Topic: IF statements in RJS files? I Need flow control!
I have a comments system working and ready. When the page is loaded and there aren't any comments, I have:
<% if @comments_submitted.empty? %>
<center><b><span id="nocomments">No one has commented yet. Be the first!</span></b></center>
<% else %>
The previous code creates an ID for my RJS file to remove when a comment is added:
page.replace_html 'nocomments', ""
Obviously, I need some sort of flow control! Because when there are comments, the "nocomments" span ID is not there. This throws an error, since there is no ID for myRJS file to replace!