Louis Adekoya
Posts: 0
Joined: Sun Nov 17, 2013 10:51 pm

How do I Display a Control Only on Mobile App?

Hi Sergiy, what am I doing wrong? I set my control to be hidden by default (visible unchecked in design mode) then on my page's page show event I have:

code
var isPhoneGapApp = function() {

Code: Select all

     return (document.URL.indexOf('http://') === -1 && document.URL.indexOf('https://') === -1); 

 }; 

if (isPhoneGapApp === "true") {
Appery("tglSubscribe").show();
}
/code

This hasn't worked.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

How do I Display a Control Only on Mobile App?

Please use "isPhoneGapApp" as a function:
preif (isPhoneGapApp()) {
Appery("tglSubscribe").show();
} /pre

Louis Adekoya
Posts: 0
Joined: Sun Nov 17, 2013 10:51 pm

How do I Display a Control Only on Mobile App?

Thanks Sergiy. Seemed promising but still doesn't work unfortunately. The control is still hidden when I use the native app on my phone. My current code (in my page's pageShow event) is:

code
var isPhoneGapApp = function() {

Code: Select all

     return (document.URL.indexOf('http://') === -1 && document.URL.indexOf('https://') === -1); 

 }; 

if (isPhoneGapApp()) {

Appery("tglSubscribe").show();

}
/code

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

How do I Display a Control Only on Mobile App?

Please move prevar isPhoneGapApp = function() {

return (document.URL.indexOf('http://') === -1 && document.URL.indexOf('https://') === -1);

}; /pre to the custom JS file.
And use JS on the page show event:
preif (isPhoneGapApp()) {
Apperyio("tglSubscribe").show();
} /pre

If it doesn't work, please share (http://devcenter.appery.io/documentat...) your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a and provide us with the following information:

1) App name
2) Test credentials if login functionality is implemented in your app
3) Detailed steps to reproduce the issue

Louis Adekoya
Posts: 0
Joined: Sun Nov 17, 2013 10:51 pm

How do I Display a Control Only on Mobile App?

In case anyone needs the solution (provided by Sergiy):

On the device ready event of my start page, I added:

Apperyio.storage.isDevice.set(true);

Then on the page show event of the page containing my hidden control (which I only want to display in the native app), I have:

if(Apperyio.storage.isDevice.get()){
Apperyio("tglSubscribe").closest(".ui-field-contain").show();
}

Return to “Issues”