facebook

JQuery N/A in Test Center

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

    alexbernal
    Member

    I got the 15 day trial version of MobiOne and I’ve had not luck getting JQuery code to be recognized.
    I have a form with one edit field and one button. Pushing the button will cause and alert with the content of the edit field to pop up. The problem is that when I write the JavaScript code using jQuery it does not work, but when I use standard JavaScript it works fine.

    WORKS: alert(document.getElementById(‘m1-testapp2-textField1’).value);

    DOES NOT WORK: alert($(‘#m1-testapp2-textField1’).val());

    I’m using Windows 7 64bit.

    #323711

    support-michael
    Keymaster

    @alexbernal

    >DOES NOT WORK: alert($(‘#m1-testapp2-textField1’).val());

    That’s odd for jquery to be N/A to your app. From your description I understand it to be a simple 2 widget mobione UI design with a JS action that runs the JS jquery snippet you provided. I wrote a similar app and that had no issues. So this is a puzzle?

    Let’s try accessing the inputfield without going through the action mechansim or using alert().
    1) Run your app in the Test Center. Enter some content in your inputfield.
    2) Open the DOM Inspector and expand the Console (at bottom of DOM inspector panel).
    3) Enter your jquery snippet followed by enter and you should see the value displayed as shown below.
    See attachment jquery-test3.png

    Here are screenshots from my example and the src is attached at the end.
    See attachment jquery-test1.png
    See attachment jquery-test2.png

    Src design file
    See attachment jquery-access-test.mobi

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

    alexbernal
    Member

    Thanks Wayne for the prompt reply. It didn’t make any sense to me either. I thought a restart of the application after installation (which I had not done) would do the trick, but it didn’t. I decided to purchase a license anyway just to see if it was a limitation that had something to do with the trial version and guess what…it now works as it should. Perhaps something to look into on your end. Thanks again!

    #324059

    alexbernal
    Member

    Hello Wayne, I thought everything was working, but now that I have the app almost finish, it is behaving the same way it did before. It’s driving me crazy. When I add the SAME javascript code to my app, it does not work, but when I add it to a one page test app it works fine. What am I doing wrong?

    Please help! This is very frustrating. I have attached both the test app and my app page that is not working.

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

    alexbernal
    Member

    Here is an image of the error message generated when I click the button.

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

    support-michael
    Keymaster

    @alexbernal

    Thanks for the extra details. I agree something is goofed up.

    Q1: can you verify that the jquery library is loading?
    – Load your app in the Test Center and open the Resource Monitor tool as shown
    See attachment jquery-load-confirm.png

    Q2: if you do not see the jquery lib loading in #1 then open a File Explorer to the generated HTML code and look in the /res subdirectory for the jquery library. Is it present?

    Q3: have you manually modified the generated code in anyway?

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

    alexbernal
    Member

    It seems to be loading fine, and I have not modified any generated code.

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

    support-michael
    Keymaster

    @alexbernal

    Your recent example gave our dev team the clue they needed to identify the problem. This is a bug which we are fixing today for the 1.5 release planned for early next week. The problem is that a Run JS action’s code is being obfuscated and goofing up a jquery reference. If you need a workaround before the 1.5 release you can move the action code to a new function you create in the main_custom.js file which the JS action will call.

    #324105

    alexbernal
    Member

    Thanks Wayne, I tried the workaround and it worked, however, I think I will wait for the release next week to complete the project.

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: JQuery N/A in Test Center

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