Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
init functions problem
madmax
hi everybody,
i have 1 local javascript(form API) and 1 global javascript (form API) for each dct in a data catagory. now the problem is for 2 differnet .js i have 2 different init functions. how can i resolve this problem.
any suggestions?
Find more posts tagged with
Comments
jbonifaci
Rename the function(s)?
KPCourseSequenceSessionInteractionReport.rptdesign
Bhargav Coca
One Option is to rename the function.
Other options, depend on what you are trying to accomplish, you events needn't be always triggered for doing some thing in init(), you can use others like,
onSave, on Mouseover.......so on and soforth, to accomplish some thing with equal ease. I need to know what you are trying to do, if possible post some snippets of your code.
thanks
madmax
i think i'll try with the renaming.
thanks .
madmax
hi ,
as u said i rename init. but it's not working. is my 1st script cmd is right?
<script language="javascript" location="webserver" src="/iwmnt/default/main/landam/WORKAREA/line/pr.js"/>
<script language="javascript" location="template-type" src="prCall.js"/>
or any other tips?
jbonifaci
That looks fine, assuming the js's are where you say they are. Is the issue you don't think one or both of the js's is being included? Just add an alert at the top of both js's with the js name. If you see the alert on form load, you know it's being included correctly.
madmax
when i use pr.js in
<script language="javascript" location="template-type" src="pr.js"/>
it works perfect.
but when i am using
<script language="javascript" location="webserver" src="/iwmnt/default/main/landam/WORKAREA/line/pr.js"/>
it's not working.
jbonifaci
Then why not just use the template-type, since it is working? You should be able to have more than one include of type template-type.
As far as why your webserver one isn't working, if pr.js is in a valid template-type directory, then your path is definitely wrong. You are missing both templatedata and either the category or data-type. But, like I said, you should be able to use the template-type location, I'm not sure why you are changing it to webserver?
LineChartTestData.zip
SampleLineChart.rptdesign
madmax
i can't because it'll be a global javascript. several data-catagory will use that external script. if i use template-type then only one data-type can use it and moreover i have to put same copy of that js file to every data-type which is not preferable.
my path is right and also no mis-typo.
so any suggestions?
FilterDialog.png
madmax
ok if i put my global java script in iw-home/httpd/iw and then referenced it
<script language="javascript" location="webserver" src="/iw/pr.js"/>
it works perfect. but then when i add my 2nd script
<script language="javascript" location="template-type" src="callP.js"/> then 2nd one is not working.
any tips?
jbonifaci
There shouldn't be any issue, unless your logic is conflicting in your two js files. I would suggest attaching the js files and someone might be able to notice if something is amiss.
saumil
Hi,
I have tested your scenario.
It is working fine, I am attaching here test code.
Envirnoment : TS 5.5.2, Solaris 8
Saumil
BTWholesale | CMS
Mahindra British Telecom
madmax
here r my files. i think there is something wrong with the logic.
they work individually but when i put them togther then it's not working.
jbonifaci
I see your problem, you can only have one onFormInit function. I would suggest having your template specific init function call the global init either at the beginning or the end of it's init function, depending on which you want to execute first.
madmax
hi jbonifaci;
can u show me in a example. that'll lot clearer.
madmax
as u said i can not have 2 onFormInit so i i removed IWEventRegistry.addFormHandler("onFormInit",initScrubing); on my global javascript
and i changed it to initScrubing(); but still it's not working. i think i have some logic error.
any help will be appriciated.
madmax
now it's working. sometimes teamsite acts weird .
thanks to everybody .
madmax
opps. now when i am tring to save the dct it takes forever and it does nothing.
madmax
opps. now when i am tring to save the dct it takes forever and it does nothing.
madmax
my pr1.js is not working . it takes forever to save. i still couldn't find what's wrong with it.
any help will be appriciated.
jbonifaci
Post your DCT along with your updated js files. Unfortunately, I am done for the week in a few minutes, but someone else should be able to help you out.