Page 1 of 1

Custom javascript file not loading

Posted: Tue Aug 20, 2013 11:32 am
by Paul_Ramcharitar
I placed a custom javascript file in "userdata/custom/js". From what I understand, if you place javascript files in there, they are loaded automatically every time you run a program.

The javascript file loads perfectly in web browsers. However when I try to load my program in the "ProfoundUI Mobile Client", I get an error: Expression 'myFunction()' contains an error: myFunction is not defined".

I'm guessing my custom javascript file wasn't loaded, hence "myFunction" wasn't found.

I'm using an Android tablet to run the ProfoundUI Mobile Client application.

Re: Custom javascript file not loading

Posted: Wed Aug 21, 2013 10:18 am
by Scott Klement
Files in the userdata/custom/js directory will be loaded automatically if you are using a PUI session in a web browser. They are not loaded automatically from the Profound UI Mobile Client, PhoneGap or Genie.

I would suggest using the 'External Javascript' property of your screen instead.

Re: Custom javascript file not loading

Posted: Wed Aug 21, 2013 11:49 am
by Paul_Ramcharitar
ok thanks

Re: Custom javascript file not loading

Posted: Thu Sep 19, 2013 9:51 am
by Paul_Ramcharitar
Hi, I used the external javascript and external css option, and none of them apply in the mobile client.

Re: Custom javascript file not loading

Posted: Thu Sep 19, 2013 10:53 am
by Scott Klement
You are using the screen-level properties, correct?

These should work in a mobile client.

Re: Custom javascript file not loading

Posted: Thu Sep 19, 2013 1:22 pm
by Paul_Ramcharitar
When I used "external javascript" and "external css" screen level properties, the files didn't load. Even when I wrapped the paths with "pui.normalizeURL".

However these functions worked for me on the browser and mobile client:

Code: Select all

pui.loadJS({path: pui.normalizeURL("/profoundui/userdata/custom_js/GetCurrentTime.js"),callback: function() {startTime();}})

Code: Select all

pui.loadCSS(pui.normalizeURL("/profoundui/userdata/custom/css/custom.css"))
The files loaded as they should.

Re: Custom javascript file not loading

Posted: Thu Sep 19, 2013 1:35 pm
by Scott Klement
Well, these APIs should work, too...

are you calling this from your onload event? Or when are you calling them?

Re: Custom javascript file not loading

Posted: Thu Sep 19, 2013 1:47 pm
by Paul_Ramcharitar
Yes in the onload event of the record format.