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
MaxxumMaxxum 

(URGENT) Maximum size for HTML in S-Control....

One of the S-Controls that I am developing has reached the maximum length limit for the HTML that can be coded as part of S-Control (I get bad data error upon save).

How do you handle large HTMLs as part of an S-Control?
Thanks in advance for your help.
MaxxumMaxxum
Is there any way I can break up my html in to two s-control and have first scontrol refere to the second scontrol?
cheers.
darozdaroz
Off the top of my head.. if you use alot of JavsScript don't embed the JS in the page, put that in another sControl and refernce the scontrol url in the script tag of the main control.
MaxxumMaxxum
That is really interesting.
Could you please tell me how I can reference the scontrol from the main control?
DevAngelDevAngel

Hi Maxxum,

First, yes, you can reference other scontrols from an scontrol.  You might do this using iframes or just navigating to another scontrol url.

The suggestion for putting as much js in a file is a good one, but I would not put the js in a separate scontrol, but instead into a document or better yet, into the file part of the scontrol.

MaxxumMaxxum
Thanks DevAngel.
If I include JS in a separate file and attach it to a S-Control, how can I reference it in my s-control?

Cheers.
DevAngelDevAngel

for your script tag use:

<script type="text/javascript" src="{!Scontrol_URL}"></script>

MaxxumMaxxum
Thanks. Let me give it a shot.
Regards.
darozdaroz


DevAngel wrote:

Hi Maxxum,

First, yes, you can reference other scontrols from an scontrol. You might do this using iframes or just navigating to another scontrol url.

The suggestion for putting as much js in a file is a good one, but I would not put the js in a separate scontrol, but instead into a document or better yet, into the file part of the scontrol.





I must have been having a 'duh' moment. Thanks.
ingnunesingnunes

Hello, good morning to all. 
 
annex some the code that I am trying to implement, the code is a SCONTROL which has a file (. js) attached. 
 
It lines her of the body he/she gives problems when calling to the function onload = "initPage (); " that this defined one in the file .js attached, the same as gives problems when calling to the function to Center (); that it is after </ body> 
 
why I can't call functions defined in the.js attached? the error: "an object was expected"

 

--------- CODE ---------------------

html>

     <head>

          <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

          <title>:: FNAC :: Reparaciones - Clientes ::</title>

          <script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>

          <script type="text/javascript" src="{!Scontrol_URL}"></script>

          </head>

          <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" onload="initPage();">

              .

              .

              .

         </body>

          <script type="text/javascript">

              Centrar();

         </script>

</html>

--------- CODE ---------------------

DevAngelDevAngel
Well, you might have an error in the attached js file.  Try just pasting the contents off the js inline in your scontrol and see if that helps.
ingnunesingnunes
the code attach in .js file works correctly if it is placed in the same SCONTROL, what is wanted is that it is not so vulnerable the code and for it i proceeded to encapsulate it in a file. js that is attach to SCONTROL. the problem this in that the calls to the functions defined in the. js that you this tiing causes error when being called from the scontrol that contains absorbed the. js
ingnunesingnunes
These were the steps:   
   
I built a file called CodeJs.js with the following code:   
  <script>   
   function MessageBox ()    
   {    
    alert ("Hello World... ");   
   }    
  </ script>   
   
Then buil a SCONTROL and with the siguente code:     
   
<html>    
         <head>    
               <put http-equiv = "Content-Type" content = "text/html; charset=windows-1252">      
  <title>:: FNAC:: Repairs - Clients:: </ title>    
  <script type = "text/javascript" src="{! Scontrol_URL} "> </ script>    
 </ head>    
   
 <body topmargin = "0" leftmargin = "0" rightmargin = "0" bottommargin = "0" onload = "MessageBox (); ">    
   
  Test    
 </ body>    
</ html>   
   
and attach CodeJs.js file.

Is it correct?? if it is correct because when loading the page it doesn't show the alert of the function MessageBox ()??   
   
ingnunesingnunes

In this case embedded code of file CodeJs.js into SCONTROL works correctly. but i need use CodeJs.js to separate HTML and JS code.

 

html>

head>

meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

title>:: FNAC :: Reparaciones - Clientes ::</title>

script type="text/javascript" src="{!Scontrol_URL}"></script>

script>

function MessageBox()

{

alert("Hello World...");

}

</script>

</head>

body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" onload="MessageBox();">

Test

</body>

</html>