Forum: Ruby on Rails javascript_tag replacing whitespaces w/ '%20'

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Clem R. (Guest)
on 2007-06-19 23:34
(Received via mailing list)

  I have a form that tests if a title has been changed since the page
loaded and the page has been submitted.  If the page title has been
then a confirm box will ask if the user wants to have the title changed.
The problem is if the person hits cancel, all white spaces in the title
replaced w/ '%20'.

Here's the code I was using:

<%=javascript_tag( "function confirmSubmit(){ var page_title_before=
                                              var page_title_on_submit =
                                            if( page_title_before !=
page_title_on_submit ){
the title of this page will break any links or bookmarks that refer to
it.\\nPress \"OK\" to save with the new title, or \"Cancel\" to revert
the original title.');
                                                 if(agree){ return true;
                         else{  alert( 'page_title_before-->>' +
escape(page_title_before) ); $('page_title').value = page_title_before;
return false; }
                                              else{ return true; }}") %>
View this message in context:
Sent from the RubyOnRails Users mailing list archive at
This topic is locked and can not be replied to.