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

Can I include more than one file in a sControl?

Can I include more than one file in an sControl?

No, an scontrol can only reference a single file; however, you can reference files in other scontrols (in theory), or stored on the web.  In addition, you can package your files into CABs, JARs or other mechanisms that might solve the problem for you.

Is there a specific use case you are looking at?


What I'll like to do is write an sControl that uses javascript to call an applet which calls the sForce API. The problem is that I've been using axis to make my calls to sForce, and axis is made up of several libraries, and if I'm not mistaking you can't put jar files in other jar files.

Message Edited by foulox on 11-14-2003 09:46 AM


> and if I'm not mistaking you can't put jar files in other jar files.

In effect, you can. Just create a new jar that has all the files of the two other jars. 

Note that because of some funky classloader stuff, you'll need to sign the applet to use Axis.

I would like to share few of the common .js files among scontrols. is this possible?
Ron HessRon Hess
yes, this is possible.
put the javascript files that you want to share into one scontrol, then link that scontrol into the other scontrols that you want to use it in.

there is an example of doing this in the Channel Finance application on AppExchange.
look for Helper Functions in the scontrols listed on the test drive.

it is included into each using this line
[ script language="JavaScript" src="{!Scontrol_URL}" ][/script ]

where the helper JS file is loaded into the "file" paramater of the scontorl.

you can also includ a JS file directly from a document in your documents tab, using the FileDownload syntax, something like this

[script language="JavaScript" src="/servlet/servlet.FileDownload?file=01530000000IOtB"][/script]

where [ == <

this second option has the advantage that a change in the JS stored in the documents tab will effect all scripts that include it.

you can probably include one scontrol directly into another as well, skipping the use of documents, but i havent tried this. The syntax would look like this

[script language="JavaScript" src="/servlet/servlet.Integration?lid=01530000000IOtB" ][/script]

Message Edited by Ron Hess on 02-20-2006 07:56 PM

Hi Ron,
I was also looking for the functionaliry to reuse the .JS file accross the S-Controls.As you suggested i was going through the Channel Finance application.I found Helper Functions S-control,and you said this s-control is included in other s-controls using
[ script language="JavaScript" src="{!Scontrol_URL}" ][/script ]
Here iam confused..when we mention like this does it include only Helper Functions S-conrol or all other S-controls functions?
And i also noticed that helperFunction.js is included in all s-controls.
Is this different than the Helper functions S-controls?.If so where can i get the source for helperFunction.js.
Iam sorry iam really confused..could you point me to a document/article where this is explained clearly how to reuse JS functions accross S-contols.