Custom javascript file not loading

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Custom javascript file not loading

Post 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.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Custom javascript file not loading

Post 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.
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Re: Custom javascript file not loading

Post by Paul_Ramcharitar »

ok thanks
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Re: Custom javascript file not loading

Post by Paul_Ramcharitar »

Hi, I used the external javascript and external css option, and none of them apply in the mobile client.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Custom javascript file not loading

Post by Scott Klement »

You are using the screen-level properties, correct?

These should work in a mobile client.
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Re: Custom javascript file not loading

Post 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.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Custom javascript file not loading

Post by Scott Klement »

Well, these APIs should work, too...

are you calling this from your onload event? Or when are you calling them?
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Re: Custom javascript file not loading

Post by Paul_Ramcharitar »

Yes in the onload event of the record format.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests