Results 1 to 2 of 2

Thread: Object referencing web\mobile

  1. #1

    Object referencing web\mobile

    Hi
    Javascript Code working in desktop mode does not run in web\phonegap mode. What is the correct way to reference other objects on the same form for mobile apps.

    I have a very simple form which I am using.

    Code copied from lib_page1_section1.js

    {
    Lianja.getElementByID("page1.section1.m_data").tex t="enter data here";
    COMMENT***code does not run on Phonegap
    }

    ////////////////////////////////////////////////////////////////
    // Event delegate for 'changed' event
    function page1_section1_m_data_changed()
    {
    Lianja.showMessage("change event");
    COMMENT: Code runs in all modes
    Lianja.getElementByID("page1.section1.field2").cap tion=Lianja.getElementByID("page1.section1.m_data" ).text;
    COMMENT***does not run in Phonegap Preview
    m_data.text="";
    COMMENT: Code runs in all modes
    };

    Hopefully this makes sense.
    Thanks in advance

    Paudie
    Last edited by paudiewalsh; 2018-11-03 at 11:36.

  2. #2
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,187
    Hi Paudie,

    In a web app in the JavaScript, all the objects must have different names. So you can do this:

    Code:
    m_data.text = "enter data here"
    Now for .getData and .setData, you would do:

    Code:
    var losxn = Lianja.get("page1.section1');
    losxn.setData("m_data","enter data here");
    Both approaches work for me in apps in production, based on the needs of that context.

    hth,

    Hank

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us