facebook

Javascript not called on btn link – ANSWERED, EXAMPLE

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

    Albatros78
    Participant

    Hi,

    I created a simple project with one push button. (mb1m9u4)
    – My project is spelled test.mobi
    – The html file of my project has reference to custom.js like:
    <script type=”text/javascript” src=”test_custom.js”></script>

    – In the source file a new file appears which is test_custom.js.
    – Into this file I have added my javascript function.
    – in the link prperties of my button I have added: javascript:test_custom.myfunction()

    When I run into test center, into the debugger with my html file I have the error message:
    24ReferenceError: Can’t find variable: test_custom

    Obviously my original code developped before on my PC (html & jav) works fine on my google or safari browsers on my Windows PC !

    I tried just to use & migrate one of my function with mb1 for tests, but no success

    Any help would be appreciate to understand how to call correctly java function from a personnal js file

    Regards

    #311855 Reply

    wayne
    Moderator

    I suspect the problem is that your custom javascript might need some type of initialization. See the attached screenshot of a simple example where I added some custom javascript to my “alert-button” design. Can you share your custom javascript file with me to review what might be happening? If you don’t want it to be public then send the file(s) to support at genuitec dot com to my attention (Wayne).

    See attachment custom-javascript.png

    Wayne
    Genuitec Mobile Team

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

    Albatros78
    Participant

    Hi wayne,

    My files are there. No problem to share them.

    Like I said, my original files (html and js file) works fine on my browser and ALSO through safari into test center if I use the complete Local URL from Safari.

    My tests were successfull in these mode
    When I try to use same javascripts into mb1 project, the link does not works. !!!

    Thanks for your help… But I don’t undertsand why it works on Safari on test center, and not into mb1 project.
    Javascript syntax is not the same ?

    Regards

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

    wayne
    Moderator

    hi albartos,

    Your example works with a couple of minor edits. Here is what I changed:

    1) changed text field Link property to javascript:initDB()

    2) changed text field element look to
    D_base = document.getElementById(“m1-Sample_DB-dbname”).value;

    3) changed exit() to return

    See attachment local-db.png

    See attachment for updates.

    Wayne
    Genuitec Mobile Team

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

    Albatros78
    Participant

    Hy Wayne,

    Thanks for your help.. very nice. Now everything is ok..

    I will post my Db example when complete in few hours.

    It would be very usefull to community and you also probabbly or you Tech Support

    Hope this helps

    Regards

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Javascript not called on btn link – ANSWERED, EXAMPLE

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