Forum Post: Using a popup as a confirmation dialog

Status
Not open for further replies.
R

riche

Guest
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?

Continue reading...
 
Status
Not open for further replies.
Top