PDA

View Full Version : Object referencing web\mobile



paudiewalsh
2018-11-03, 12:34
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").text="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").caption=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

HankFay
2018-11-03, 12:58
Hi Paudie,

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


m_data.text = "enter data here"

Now for .getData and .setData, you would do:


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