You need to sign in to do that
Don't have an account?

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)?
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
{!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

What is exception error you are getting on Rich text .. Use javascript to replcase the line break

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?