Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Call custom Javascript from page.load

I have this simple code to start with, and I want to fire it on each page thats loaded, but it seems to not fire at all and I cannot understand why.

Here is the function:

precode
book = {};

book = {
"intro" : [{
"bookName" : "The Books Name"
}],

Code: Select all

 "page1": [{ 
     "text" : "This is the text that will be displayed on page 1 of the book.", 
     "images" : { 
         "image1" : 'localfile to image', 
         "image2" : 'localfile to image', 
         "image3" : 'localfile to image' 
     } 
 }], 

 "page2": [{ 
     "text" : "This is the text that will be displayed on page 1 of the book.", 
     "images" : { 
         "image1" : 'localfile to image', 
         "image2" : 'localfile to image', 
         "image3" : 'localfile to image' 
     } 
 }], 

 "page3": [{ 
     "text" : "This is the text that will be displayed on page 1 of the book.", 
     "images" : { 
         "image1" : 'localfile to image', 
         "image2" : 'localfile to image', 
         "image3" : 'localfile to image' 
     } 
 }], 

 "page4": [{ 
     "text" : "This is the text that will be displayed on page 1 of the book.", 
     "images" : { 
         "image1" : 'localfile to image', 
         "image2" : 'localfile to image', 
         "image3" : 'localfile to image' 
     } 
 }], 

 "page5": [{ 
     "text" : "This is the text that will be displayed on page 1 of the book.", 
     "images" : { 
         "image1" : 'localfile to image', 
         "image2" : 'localfile to image', 
         "image3" : 'localfile to image' 
     } 
 }], 

 "page6": [{ 
     "text" : "This is the text that will be displayed on page 1 of the book.", 
     "images" : { 
         "image1" : 'localfile to image', 
         "image2" : 'localfile to image', 
         "image3" : 'localfile to image' 
     } 
 }] 

};

//console.log(book.page1[0].text);

function GetText(page) {

Code: Select all

 console.log(page); 

 var pText; 

 switch(page) { 

     case "p1" : 
         pText = book.page1[0].text; 
         break; 

     case "p2" : 
         pText = book.page2[0].text; 
         break; 

         } 

 console.log(pText); 

}
/code/pre

On the pages, I have this:

Image

The console.log above the function shows the text as it should, but any console.log in the function is not fired. I have tried:

precode
var GetText = function(page) {
/code/pre
precode
GetText = function(page) {
/code/pre

None seem to fire though, any reason this would not work in Appery ?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Call custom Javascript from page.load

Hello -

The custom code debugging is usually falls outside the scope of our support, we will need some time for our developer to look at this issue.

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Call custom Javascript from page.load

Its not the custom code thats wrong, it's the firing from the page to any function, does not matter whether its this code and any other.

Whats the correct way for Appery to fire a function which is in a custom file ?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Call custom Javascript from page.load

Sorry, was my hasty assessment.

According to our documentation should work this way: http://devcenter.appery.io/documentat...

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Call custom Javascript from page.load

Okay, it was because I was using the tablet and it was within the content frame. For some reason, when its in that frame, its unable to access any javascript function.

So it was Appery after all :)

Return to “Issues”