facebook

project_custom.js App does not see

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #339016 Reply

    jefflefavi
    Member

    My app no longer see my projectname_custom.js

    I have a multiple screen App that had been able to see my _custom.s

    After – but no immediately after adding a new screen, a new Start Screen, my function no longer execute.

    I have put Alerts in any _custom files that are under the main directory for this App – nothing shows up.

    In the new Start Screen I put the two Screens in “Additional Project Files” in order to do a gotoPage to them. It did work for a short time. I took them out but it still does not work.

    I have executed the Screens individually but they do not work.

    I created a new screen not connect to anything and it was able to execute a javascript function.

    I have no idea what I did. It looks like my screens do not know where my custom.js file is located.

    Please help.

    Thank you,
    Jeff

    #339028

    nvts
    Member

    Hello,

    The first/calling screen name is were you put your custom code. It sounds like you now have a new startup screen. The code needs to only be in this new custom.js file.

    Also some changes might need to be made if you referenced the old startup screen of your app.

    I always make sure that I only have the screen-www folder for the main screen/startup to avoid problems.

    Yes. If screens are only being referenced by a goto then yes add them to the additional in the new main/startup screen.

    Cheers…

    Howard

    #339039

    jefflefavi
    Member

    My Start screen only references two of the screens by goto’s. But other screens use the Button goto and Back key to go to them. Let me show you, might make more sense:

    ———————————————– Screen 3a (uses Return Button to return to Screen 2a)

    ———————————————– Screen 3b (uses Return Button to return to Screen 2a)
    ————– Screen2a (uses button to go to 3a, 3b)|

    startScreen (javascript gotoPage 2a, 2b) |

    ————– Screen2b (uses button to go to 3c, 3d)|
    ———————————————— Screen 3c (uses Return Button to return to Screen 2b)

    ———————————————— Screen 3d (uses Return Button to return to Screen 2b)

    startScreen strictly does a gotoPage, no buttons. So what is the rule here for Add Reference?

    The alerts I placed in the new startScreen _custom.js do not fire.

    I will get rid of the other -www directories and let you know what happens on them. I think they are created when I just test a single screen, so if that is the problem, they it will be constantly recurring.

    Thanks for the help,
    Jeff

    #339041

    jefflefavi
    Member

    In the project directory I changed all of the directories ending in “-www” to “-w”, except for the startScreen-www.

    No function will executed.

    in:
    phoneui.documentReadyHandler = function() {
    alert(‘startScreen’);
    }

    Alert does not show.

    ANy suggestions.

    #339053

    nvts
    Member

    Is it possible to post your project or the custom.js file? It is hard to see why and help you as what you post should be working.

    Cheers…

    #339059

    Hi Jeff,

    Since you stated:
    >After – but no immediately after adding a new screen, a new Start Screen, my function no longer execute.
    I assume that you are using more than one _custom.js file, am I correct?

    Please note that you should put all your functions in the <mainScreen>_custom.js file. If you already had a main screen(mainScreenOld) with its _custom.js file and then you added a new main screen(mainScreenNew) when you run/generate files for mainScreenNew, it will only recognize code in mainScreenNew-www/mainScreenNew_custom.js file. If this is your case, you need to move the code in your mainScreenOld_custom.js to mainScrenNew_custom.js

    Hope this is helpful.

    #339131

    jefflefavi
    Member

    Good idea but that is not the problem. The newMainScreen-custom.js has test Alerts I put in them to see if they are executed – they do not execute.

    The newMainScreen was suppose to decide which screen to show at start up. This did work for a short time. But now that just the newMainScreen shows when running it. I put as button on newMianScreen for a test. I click the button and it does not run the javascript (only thing the javascript does is do an Alert).

    “Test center” shows that the custom.js is newMainScreen_custom.js – it is the test code in the javascript file. So it is looking at the correct java code but not executing it.

    I have no idea what I did, between the time it work than stopped working. Any more ideas?

    Jeff

    the button does a run javascript on say_hi();

    Here is the custom javascript:
    /**
    * Notification that the UI is about to transition to a new screen.
    * Perform custom prescreen-transition logic here.
    * @param {String} currentScreenId
    * @param {String} targetScreenId
    * @returns {boolean} true to continue transtion; false to halt transition
    */
    phoneui.prePageTransition = function(currentScreenId,targetScreenId) {
    // add custom pre-transition code here
    // return false to terminate transition
    return true;
    }

    /**
    * Notification that the UI has transitioned to a new screen.
    *
    * @param {String} newScreenId
    */
    phoneui.postPageTransition = function(newScreenId) {
    alert(‘transition’);
    }

    /**
    * Notification that device orientation has changed.
    *
    * @param {String} newOrientation
    */
    phoneui.postOrientationChange = function(newOrientation) {
    alert(‘Or’);
    var isLandscape = Math.abs(newOrientation) == 90;
    if (isLandscape) {
    phoneui.gotoPage(‘m1-WhoAmILandscape’,phoneui.transitions.none);
    } else {
    phoneui.gotoPage(‘m1-WhoAmI’,phoneui.transitions.none);
    }
    }

    /**
    * Called when document is loaded.
    */
    phoneui.documentReadyHandler = function() {
    alert(‘WAIMain’);
    alert(‘loaded’);
    phoneui.gotoPage(‘m1-WhoAmI’,phoneui.transitions.none);
    }

    function get_device(){
    alert(‘get_device’);

    var x = device.name;
    $(‘#m1-WhoAmI-txtName’).val(x);

    x = device.cordova;
    $(‘#m1-WhoAmI-txtCordova’).val(x);

    x = device.platform;
    $(‘#m1-WhoAmI-txtPlatform’).val(x);

    x = device.uuid;
    $(‘#m1-WhoAmI-txtUUID’).val(x);

    x = device.version;
    $(‘#m1-WhoAmI-txtVersion’).val(x);
    alert(“end of get_device’);
    }

    function say_hi(){
    alert(‘hi’);
    }

    #339139

    Hi Jeff,

    It’s hard to know what is the problem exactly. Could you share your project with us to take a look? If you want to keep the data in privacy you can send it to support at genuitec dot com. Use title mobione data from jefflefavi

    #339155

    Same Issue. I can no longer get code in the _custom.js file to execute. It appears to not exist. My first test programs worked fine. I have rebooted, set up new project file, reconstructed app, all to no avail. Driving me crazy… Suggestions????

    #339156

    support-michael
    Keymaster

    > I can no longer get code in the _custom.js file to execute

    This sounds like you have a syntax error in your js code. To determine if you have a js error use the javascript debugger in the Test Center as follows:
    1) run your webapp in the Test Center
    2) Open the tool panel and select Debugger, this will open the JavaScript debugger
    3) select scripts drop-down menu and choose the javascript file that contains your code that will not execute. If you do not see your javascript file in the list of scripts then it either contains a syntax error and fails to load or the file is not in generated code. For the later open the project’s <project>_www/ directory and confirm that the file is present.
    See attachment debugger-script-list.png
    4) at this point the debugger should be listing your js file. Scroll it down and confirm that no error markers are on the file.

    Let us know what you determine.

    Attachments:
    You must be logged in to view attached files.
    #339161

    support-michael
    Keymaster

    A couple of other thoughts:

    1) turn off Offline Support on your project
    – this will ensure that no app cache is interceding and preventing loading of an updated js file

    2) when in doubt try running the webapp version of your project in Chrome or Safari (must be a webkit based browser)

    #339164

    Thanks. Finally found my problem. I failed to remove or take into account the M1- CSS prefix which is reinserted on resets and new app starts. This is likely a annoying problem to others as well. Maybe you need set default prefix at “” to reduce this confusion. I was about to give up on this fine product.

    #339165

    support-michael
    Keymaster

    Glad it worked out for you. The prefix for all css and html ids can be adjusted in the Design Center settings. We introduce the default prefix to avoid the massive headache of debugging a project where a user does not respect the requirement that all dom node ids must be unique across the project. Those type of bugs are a mother to isolate.

    #339195

    jefflefavi
    Member

    The custom file name is “WAIMain_custom.js”, it does not show in the debugger, though source code in the tools menu shows the file with the correct contents.

    The debugger shows the following javascript files:
    jquery-1.8.3.min.js
    main.js
    phoneui-map.js
    phoneui.js
    spinningwheel.js
    WAIMain.js

    I have sent you the source code.

    #339290

    Hi jeff,

    Thanks for sharing your project. I’ve found out that you have a syntax error in your alert. You’ve opened the string with double quotes and closed it with simple quotes.

    @jefflefavi wrote:



    x = device.version;
    $(‘#m1-WhoAmI-txtVersion’).val(x);
    alert(end of get_device);
    }

    function say_hi(){
    alert(‘hi’);
    }

Viewing 15 posts - 1 through 15 (of 17 total)
Reply To: project_custom.js App does not see

You must be logged in to post in the forum log in