Hello,
I try to figure out how to use the script.aculo.us scripts and followed
the example on their webpage, but still getting errors, like "element
has no properties".
I have the following code:
view/add.rhtml
============<%= javascript_include_tag :defaults %>
<html><head>
<script src="../javascripts/prototype.js"
type="text/javascript"></script>
<script src="../javascripts/scriptaculous.js"
type="text/javascript"></script>
<script type="text/javascript" language="javascript">
// <![CDATA[
Effect.Appear(''edit_text'');
// ]]>
</script>
</head>
<body>
<div id="edit_text">
<p id="editme2"><%= textilize(@fancy_text) </p>
<script language="JavaScript">
new Ajax.InPlaceEditor(''editme2'',
''update_text'',
{rows:15,cols:40,loadTextURL:''return_unformatted_text''});
</script></div>
</body>
</html>
controller/shop_controller.rb
============================class ShopController < ApplicationController
require ''in_place_editor''
def add
#get the text to display initially
@fancy_text = "Some fancy *bold* and _emphasized_ text."
end
def update_text
#save your text here, and return the saved value
@fancy_text = params[:value]
render :layout => false, :inline => "<%= textilize(
@fancy_text )
%>"
end
def return_unformatted_text
#get your text and return it without the formatting
@fancy_text = "Some fancy edited, *bold* and _emphasized_ text."
render :layout => false, :inline => "<%= @fancy_text
%>"
end
end
I hope somebody can help me with this one.
Another question:
I am looking for an in_place_edit function (hopefully with
script.aculo.us) to be used with mysql-database. Does anybody have code
example on this?
I found a lot of examples on the web but none of them worked for me
Best regards,
Mark
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---