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
mikeolmikeol 

Preformating issues

1. If I write a simple Java script outside of Salesforce (no AJAX, etc.) that writes some text in an alert, prompt or confirm with double spaces between words or leading spaces before a line it prints out exactly as provided, e.g. alert("     Fred") produces "     Fred".  If I do the same inside S-Control the double spaces become single and the leading spaces disappear, i.e. I get "Fred".  There's a HTML tag <PRE> </PRE> that sets whether spacing is preserved of not.  But how do I effect the same thing within AJAX / alerts, etc?
 
2: In a contract if I put leading spaces into a text field, e.g. Special Terms, with multiple lines, e.g.
"04/10/06 MO'L: No Charge Service Upgrade - September 2006
    Data Plan name changed from HiBIS Premium 3 to BC Premium I
    Cap Allowance changed from 3 GB to 5,000 MB"
 
Then the record is displayed by Salesforce without the leading spaces (rows 2 and three) and looks as follows:
"04/10/06 MO'L: No Charge Service Upgrade - September 2006
Data Plan name changed from HiBIS Premium 3 to BC Premium I
Cap Allowance changed from 3 GB to 5,000 MB"
 
If I edit it, then the leading spaces show to still be in place.  Seems to me Salesforce should preserve the way the data is displayed.
 
3:If I have some AJAX that has the line Special_Terms = "{Contract_SpecialTerms}" and the SpecialTerms field looks like the above (I'm guessing the carriage returns cause the grief) then the script will fail with an unterminated literal error.  To get around this I have to Select the data into a field using SQL.  I presume this is a shortcoming of the "{variable}".  Is this reasonable or a bug? 
dcwdcw
I am having similar problems with a text formula field where I need to add leading spaces to allow me to join SFDC data with SFDC data.  Did you ever find a way to do this?