function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nununinununi 

URLEncode problem

Hi, I am trying to copy data from Lead to a custom object using javascript button. When a lead rich text field contains line spaces, it gives me an error. So i used URLencode which resolves the error but the spaces are substituted with '+'. Is there a way to copy the text as is (including line spaces)?
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")} 


var p1 = new sforce.SObject("Place__c"); 
p1.Name = '{!Lead.Place_1__c}';
p1.Place_Text__c = '{!URLENCODE(Lead.Place_1_About__c)}';


var result = sforce.connection.create([p1]);


if(result[0].getBoolean("success")){
   alert('New record updated successfully');
}
else{
  alert('Error : '+result);
}

example:
Place 1 Intro Place 1 Intro Place 1 Intro Place 1 Intro v v v vPlace 1 Intro Place 1 IntroPlace 1.

Intro Place 1 Intro Place 1 Intro. Place 1 Intro Place 1 Intro Place 1 Intro Place 1 Intro Place 1 Intro Place 1 Intro Place 1 Intro Place 1 Intro Place 1 Intro v v Place 1 Intro

gets converted to

Place+1+Intro+Place+1+Intro+Place+1+Intro+Place+1+Intro+v+v+v+vPlace+1+Intro+Place+1+IntroPlace+1.%3Cbr%3E%3Cbr%3EIntro+Place+1+Intro+Place+1+Intro.%C2%A0Place+1+Intro+Place+1+Intro+Place+1+Intro+Place+1+Intro+Place+1+Intro+Place+1+Intro+Place+1+Intro+Place+1+Intro+Place+1+Intro+v+v+Place+1+Intro
viruSviruS
What is exception error you are getting on Rich text .. Use javascript to replcase the line break 
nununinununi
I am getting an Illegal token error whenever there is a line break.. Can you tell me how to use javascript to replace the line break?