I have a popup that I use for messages (information, error, warning) and I would also like to have a question one. I did get it working, but am wondering if there is a better way.
So I created a popup
I handle the button clicks by setting the sessonStorage var and closing the popup:
In the Before position event, I set it up:
To use it, I have a javascript file with the following function that I call with parameters:
DisplayQuestion = function(messageString, displayTitle, form) {
sessionStorage.setItem("message", messageString);
sessionStorage.setItem("displayTitle", displayTitle);
Appery.openPopup('QuestionPopup', form);
};
So in my event that I want to have this dialog, I do the following so that I can get the "callback" from the selected value:
QuestionPopup.popupafterclose = function() {
var retVal = sessionStorage.getItem('questionResponse');
if (retVal === "yes")
DisplayMessage("info", "You clicked Yes!", false, $(this));
else
DisplayMessage("info", "You clicked No or didn't choose!", false, $(this));
QuestionPopup.popupafterclose = null;
};
DisplayQuestion("I have a question for you.", true, $(this));
This seems to be working fine, but is there a better way?
Can I utilize the JQuery Mobile Dialog instead and if so should I?
Hello,
Just some feedback.
The JQuery Mobile Dialogs are deprecated in 1.4.0 and have been removed in 1.5.0 and popups seem to be the new approach:
demos.jquerymobile.com/.../popup
The popups support in the Mobile App Builder is based on jQuery Mobile Popups.
A suggestion to what you have is that you could pass the callback as a parameter to your DisplayQuestion function.
Depending on your particular needs, you could also use PhoneGap's notifications:
docs.phonegap.com/.../cordova_notification_notification.md.html
The benefit of using PhoneGap's notifications is that the dialogs would have the look and feel of the platform and you can control the title of the dialog (which you cannot do if using JavaScript's alert, confirm, prompt).
The disadvantage is that you would need to alternate code for when testing the app from a web browser or running the app as a web app.
I hope this helps.
Hi Rich:
The Mobile development team will review this issue when the team is back in the office on Monday.
Thanks
Evan
Hello,
Just some feedback.
The JQuery Mobile Dialogs are deprecated in 1.4.0 and have been removed in 1.5.0 and popups seem to be the new approach:
demos.jquerymobile.com/.../popup
The popups support in the Mobile App Builder is based on jQuery Mobile Popups.
A suggestion to what you have is that you could pass the callback as a parameter to your DisplayQuestion function.
Depending on your particular needs, you could also use PhoneGap's notifications:
docs.phonegap.com/.../cordova_notification_notification.md.html
The benefit of using PhoneGap's notifications is that the dialogs would have the look and feel of the platform and you can control the title of the dialog (which you cannot do if using JavaScript's alert, confirm, prompt).
The disadvantage is that you would need to alternate code for when testing the app from a web browser or running the app as a web app.
I hope this helps.
Understood. I'm going to further display my absolute newb-ness.
So, the pressing question, given the fact that I want this app to run on a IOS device, would be whether it would be accepted by them if I had a custom popup. I ask because all I see is that they are extremely picky.
What is the preferred method? We are planning this being a mobile web app because we will be utilizing phonegap, so we should just use native features correct?
If we weren't planning on using phonegap, then I would just use my custom popup because the javascript confirm is annoying and I wouldn't have to worry about Apple accepting my app or not based on it.
Could you give an example of using "alternate code" for testing web browser vs web app?