LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > javascript_tag replacing whitespaces w/ '%20'

Reply
 
Thread Tools Display Modes
  #1  
Old 06-19-2007, 12:31 PM
clem_c_rock clem_c_rock is offline
New Member
 
Join Date: Apr 2007
Posts: 7
Default javascript_tag replacing whitespaces w/ '%20'

Hello,

I have a form that tests if a title has been changed since the page was loaded and the page has been submitted. If the page title has been changed 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 get replaced w/ '%20'.

Here's the code I was using:

Code:
<%=javascript_tag( "function confirmSubmit(){ var page_title_before= '#{u @page.title}';
                                              var page_title_on_submit = escape($('page_title').value);
	                                          if( page_title_before != page_title_on_submit ){ 
	                                              var agree=confirm('Changing 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 to 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; }}") %>
Reply With Quote
  #2  
Old 06-19-2007, 12:57 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
Is this problem LiteSpeed specific or just same thing happened with other platform like mongrel or WEBrick?

We are not RoR experts, seems to me that the "escape()" function encode space into %20 .
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:29 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.