Page 1 of 2

How to give a Caption to an alert box?

Posted: Sun Aug 04, 2013 3:35 pm
by John Herdean

Hi, in the simple JS code:

alert('message');

Image

I get the name.html of the page for the caption. How can i assign the caption in the JS?


How to give a Caption to an alert box?

Posted: Sun Aug 04, 2013 3:49 pm
by Igor

Hi,

It should be something like this:

precode
Appery('mobileheader1').text('message');
/code/pre


How to give a Caption to an alert box?

Posted: Sun Aug 04, 2013 6:25 pm
by John Herdean

im kinda confused. I dont want 'mobileheader_name' as my caption. I want to write my own caption other than the name of the page. The line you gave me does the same thing as before. Please give me a better example.


How to give a Caption to an alert box?

Posted: Mon Aug 05, 2013 7:41 am
by Ole Henrik Oftedal

Hi!

I have the same problem, and I dont think this will help.

When we try to present the App on IPad i.e. for Apple reviewer we want to convince them that this is a real app. When we use Alert("Welcome to my app") we get the name of the page + .html in the dialogue.

Alert gives us the name of the html page in the title. This looks very bad on the screen :-(


How to give a Caption to an alert box?

Posted: Mon Aug 05, 2013 2:18 pm
by Kateryna Grynko

Hi,

Create a special popup, which pulls out of localStorage Title and Message. Next, in JavaScript assets describe function my_alert (title, message) that records these variables in localStorage and calls popup. On popup place needed buttons (such as OK) that will close popup (maybe more).

With some effort, the very serious functionality can be implemented on such popup basis, not only alert, but also smart dialogue with Yes / No / Cancel / etc.


How to give a Caption to an alert box?

Posted: Mon Aug 05, 2013 4:13 pm
by Ole Henrik Oftedal

Ok. Thanks Katya!

Appery support is superior. Always leading us in the right directions :)

Introduce my_alert js function:

Image

Create a popup screen and name it popup1 with two components mobileheader1 and mobilelabel_3

On a button on the main form run this JavaScript:
my_alert('My Title','Hello and welcome to my App. This is a very very very long long text');

In Your JavaScript asset add this to new or any file
function my_alert(my_title,my_text)
{
localStorage.setItem('my_title', my_title);
localStorage.setItem('my_text', my_text);
Appery.navigateTo('popup1', {});
}

on popup1 Show event Add this JavaScript:
Appery('mobileheader1').text(localStorage.getItem('my_title'));
Appery('mobilelabel_3').text(localStorage.getItem('my_text'));


How to give a Caption to an alert box?

Posted: Tue Sep 24, 2013 12:10 pm
by Kirit Vaghela

Please stackoverflow answer

http://stackoverflow.com/questions/10...


How to give a Caption to an alert box?

Posted: Sun Jan 26, 2014 9:12 am
by Robert Larsen

"In Your JavaScript asset add this to new or any file
function my_alert(my_title,my_text)
{
localStorage.setItem('my_title', my_title);
localStorage.setItem('my_text', my_text);
Appery.navigateTo('popup1', {});
} "

Im lost on this part.


How to give a Caption to an alert box?

Posted: Sun Jan 26, 2014 9:19 am
by Alena Prykhodko

Do you have question regarding adding code to JS asset or code itself?


How to give a Caption to an alert box?

Posted: Sun Jan 26, 2014 9:24 am
by Robert Larsen

Both, where in the JS asset do I place this, and do I place this in JS asset for the popup? And do I replace all (my_title) to whatever I would like my title to read?