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
AsymtekAsymtek 

JavaScript - Urlencode & Isocode

I inherited an S-Control with JavaScript that is mimicking the clone button. I am a real newbie with JavaScript .  I have pinpointed the source of the program bombing to the fact that a text field has spaces. Of course the Users must have their spaces.  I learned that I need urlencode but I do not know the format. Can someone help me along?

//ESR Quote Notes
(needs additional code to eliminate spaces)
url +="&00N30000001J1Il="+"{!ESR__c.ESR_Quote_Notes__c}";

 This piece is giving me an error because it is copying the isocode and the value, e.g.., USD 10.00.  How do I strip out the isocode?

//Set ESR Quote Price (because of setting currency)
url +="&00N30000001J1fo="+"{!ESR__c.ESR_Quote_Price__c}";

 

Button Code in its entirety

<html>
<head>
<script type="text/javascript"
src="/js/functions.js"></script>
<script src="/soap/ajax/12.0/connection.js"></script>
<script language="JavaScript">

function redirect()
{
returnURL = "%2F{!ESR__c.Id}";
cancelURL = "%2F{!ESR__c.Id}";
url="";
url += "/a00/e?retURL="+returnURL;
url +="&cancelURL="+cancelURL;

//Set ESR Factory
url +="&00N30000001cZ14="+"{!ESR__c.Factory__c}";
//Set ESR Name and ID
url +="&CF00N30000002FftR="+"{!ESR__c.Name}";
url +="&CF00N30000002FftR_lkid="+"{!ESR__c.Id}";
//Set ESR Account
url +="&CF00N30000001JncQ="+"{!ESR__c.Account__c}";
url +="&CF00N30000001JncQ_lkid="+"{!ESR__c.AccountId__c}";
//Set ESR Opportunity
url +="&CF00N30000001JPji="+"{!ESR__c.Opportunity__c}";
url +="&CF00N30000001JPji_lkid="+"{!ESR__c.OpportunityId__c}";
//Set ESR Territory to Account Territory
url +="&00N30000001J1LH="+"{!ESR__c.Territory__c}";
//Set ESR Descriptions Elements
url +="&00N30000001J1aW="+"{!ESR__c.Description_of_Problem__c}";
url +="&00N30000002Fft8="+"{!ESR__c.Suggested_Solution__c}";
url +="&00N30000002Fft9="+"{!ESR__c.Supporting_Information__c}";
//Set ESR Qty
url +="&00N30000001J1jn="+"{!ESR__c.ESR_Qty__c}";
//Set Model Platform
url +="&00N30000001J1bk="+"{!ESR__c.Model_Platform__c}";
//Set Valve 1
url +="&00N30000002Fftg="+"{!ESR__c.Valve_1__c}";
//Set Valve 2
url +="&00N30000002Ffth="+"{!ESR__c.Valve_2__c}";
//Set ESR Lead time
url +="&00N30000001J1iB="+"{!ESR__c.ESR_Lead_Time__c}";
//Set DataFlo Number and Description
url +="&00N30000001J1fW="+"{!ESR__c.DataFlo_Number__c}";
url +="&00N30000001J1fH="+"{!ESR__c.DataFlo_Description__c}";
//ESR Repeat Order requote checkbox
url +="&00N30000001J1ia="+"1";
//Set Assembly Lead Time
url +="&00N30000001J1iG="+"{!ESR__c.Assembly_Lead_Time__c}";
//Complete And Accurate
url +="&00N30000002Ffuo="+"{!ESR__c.Complete_and_Accurate__c}";
//Set ESR Quote Price
url +="&00N30000001J1fo="+"{!ESR__c.ESR_Quote_Price__c}";
url +="&01I300000009XYi="+"{!ESR__c.CurrencyIsoCode }";
//ESR Quote Notes
url += "&00N30000001J1iL="+"{!ESR__c.ESR_Quote_Notes__c}";

parent.frames.location.replace(url);
}

redirect();

</script >

</head>

<body>
</body>
</html>