Hi Walter,
again sorry for the late reply!
Could you please specify how to escape/unescape the contents of a
form.
This here doesn't work:
View (_file_contents):
<div id="editme"><%= CG::unescapeHTML(file_contents) %></div>
<%= in_place_editor 'editme',
:url => url_for({ :action => 'save_file', :path => path }),
:save_text => 'save',
:rows => 20,
:cols => 5
%>
Controller:
def file_contents
file_path = CGI::unescape(params[:path])
begin
# ...
render :partial => 'ide/partials/file_contents', :locals =>
{ :path => file_path, :file_contents =>
_get_file_contents(file_path) }
end
end
def save_file
file_path = URI::unescape(params[:path])
file_content = CGI::unescapeHTML(params[:value])
begin
# ...
render :partial => 'ide/partials/myPartial', :locals =>
{ :path => file_path, :file_contents =>
_get_file_contents(file_path) }, :layout => false
end
end
Thanks, Tom.
> You need to escape the code you send to the browser to display in any
> form field. It is the browser's responsibility to display it to you on
> screen as the characters represented by the escape sequence. And when
> it is submitted back to your server by the form, it will also be in the
> form of the actual characters, not the escape sequence.
>
> Walter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---