Page 3 of 8

jquery popup as confirmation

Posted: Sun Sep 22, 2013 12:08 pm
by Doug Black

The caption text here should read "Nursery Alert Says...". The title text should say "Passwords do not match...etc". Image


jquery popup as confirmation

Posted: Sun Sep 22, 2013 1:00 pm
by Alena Prykhodko

Please post code that you use.


jquery popup as confirmation

Posted: Sun Sep 22, 2013 7:45 pm
by Doug Black

It's the same code as listed above. We call the code using:

MessageDialog( 'Nursery Alert', 'Your password blah blah blah' )


jquery popup as confirmation

Posted: Mon Sep 23, 2013 7:50 am
by Maryna Brodina

Hello! Please try the following code:
pre<div data-role="popup" data-dismissible="false" data-overlay-theme="a" data-theme="c" style="max-width:400px;" id="myDialog" class="ui-corner-all">
<div data-role="header" data-theme="a" class="ui-corner-top">
<h1 class="dlg_caption">&nbsp;<&#47;h1>
<&#47;div>
<div data-role="content" data-theme="d" class="ui-corner-bottom ui-content">
<h3 class="dlg_title">&nbsp;<&#47;h3>
<p class="dlg_text">&nbsp;<&#47;p>
<a href="#" data-role="button" class="okButton" data-inline="true" data-theme="c">OK<&#47;a>
<a href="#" class="noButton" data-role="button" data-inline="true" data-transition="flow" data-theme="b">NO<&#47;a>
<a href="#" class="cancelButton" data-role="button" data-inline="true" data-transition="flow" data-theme="b">Cancel<&#47;a>
<&#47;div>
<&#47;div>
<script>
function MessageDialog( caption, title, text, options ){
function closePopup( next ){
return function( event ){
next&#46;apply( this, arguments );
$( '#myDialog' )&#46;popup( "close" );
}
}
var $dlg = $( '#myDialog' );
options = $&#46;extend({}, {
onOK: closePopup( $&#46;noop ),
onNO: null,
onCancel: null
}, options)
$dlg&#46;find( '&#46;cancelButton' )&#46;toggle( $&#46;isFunction(options&#46;onCancel) );
$dlg&#46;find( '&#46;noButton' )&#46;toggle( $&#46;isFunction(options&#46;onNO) );
$dlg&#46;find( '&#46;okButton' )&#46;off('vclick')&#46;on({ vclick: closePopup( options&#46;onOK )});
$dlg&#46;find( '&#46;noButton' )&#46;off('vclick')&#46;on({ vclick: closePopup( options&#46;onNO ) });
$dlg&#46;find( '&#46;cancelButton' )&#46;off('vclick')&#46;on({ vclick: closePopup( options&#46;onCancel ) });
$dlg&#46;find( '&#46;dlg_caption' )&#46;text( caption '' );
$dlg&#46;find( '&#46;dlg_title' )&#46;text( title '' );
$dlg&#46;find( '&#46;dlg_text' )&#46;text( text || '' );
$dlg&#46;popup( "open" );
}
<&#47;script>/pre


jquery popup as confirmation

Posted: Mon Sep 23, 2013 10:56 am
by Doug Black

PERFECT! Thank you!


jquery popup as confirmation

Posted: Wed Jan 29, 2014 3:11 pm
by ciccio

hello ,
in my app i have several distinct pages (not rendered in one html)
i followed your instructions so
on my first login page
1) i added the html component and added the html Marina suggested.
2) i setted it to invisile and i saved it as a custom component.
3) on the success event of a rest i added a js :
codeif (messaggio2 == 'NON OK') {
&#47;&#47;alert('Username o password errata');
MessageDialog( 'Real Time Doctors', 'Attenzione', 'Username o password errata' );
return;
}/code

and everythings works on the login page.

then on another page Registration page i did the steps added the custom component previously saved and on a button click i added
codeif (Appery('toggle_Privacy')&#46;val()=="off") {
&#47;&#47;alert("per continuare devi prima leggere ed accettare l'informativa sulla privacy");

Code: Select all

MessageDialog( 'Real Time Doctors', 'Attenzione', 'you have to accept privacy conditions' );}/code 

where 'toggle_Privacy' is a toggle component in my page.

i tested my app on the chrome and i get no errors in the cosole

But while the login page works in the registration page if i try the alert it works while if try to open the jquery popup nothing appens

is it something wrong with my steps


jquery popup as confirmation

Posted: Wed Jan 29, 2014 7:18 pm
by Kateryna Grynko

Hi,

Does this condition pass?preif (Appery('toggle_Privacy')&#46;val()=="off")/pre
You can set an alert to check this.


jquery popup as confirmation

Posted: Thu Jan 30, 2014 8:16 am
by ciccio

i already did it and the condition pass


jquery popup as confirmation

Posted: Thu Jan 30, 2014 2:10 pm
by Maryna Brodina

Hello! If you want to use this popup on several screens:
1) In HTML component you use to create custom component should be precode<div data-role="popup" data-dismissible="false" data-overlay-theme="a" data-theme="c" style="max-width:400px;" class="ui-corner-all myDialog">
<div data-role="header" data-theme="a" class="ui-corner-top">
<h1 class="dlg_caption">&nbsp;<&#47;h1>
<&#47;div>
<div data-role="content" data-theme="d" class="ui-corner-bottom ui-content">
<h3 class="dlg_title">&nbsp;<&#47;h3>
<p class="dlg_text">&nbsp;<&#47;p>
<a href="#" data-role="button" class="okButton" data-inline="true" data-theme="c">OK<&#47;a>
<a href="#" class="noButton" data-role="button" data-inline="true" data-transition="flow" data-theme="b">NO<&#47;a>
<a href="#" class="cancelButton" data-role="button" data-inline="true" data-transition="flow" data-theme="b">Cancel<&#47;a>
<&#47;div>
<&#47;div>/code/pre
2) Create new JS asset with the following code precodefunction MessageDialog( caption, title, text, options ){
function closePopup( next ){
return function( event ){
next&#46;apply( this, arguments );
$dlg&#46;popup( "close" );
$dlg = null;
}
}
var $dlg = $( '&#46;myDialog', $&#46;mobile&#46;activePage );
options = $&#46;extend({}, {
onOK: function(){},
onNO: null,
onCancel: null
}, options)
$dlg&#46;find( '&#46;cancelButton' )&#46;toggle( $&#46;isFunction(options&#46;onCancel) );
$dlg&#46;find( '&#46;noButton' )&#46;toggle( $&#46;isFunction(options&#46;onNO) );
$dlg&#46;find( '&#46;okButton' )&#46;off('vclick')&#46;on({ vclick: closePopup( options&#46;onOK )});
$dlg&#46;find( '&#46;noButton' )&#46;off('vclick')&#46;on({ vclick: closePopup( options&#46;onNO ) });
$dlg&#46;find( '&#46;cancelButton' )&#46;off('vclick')&#46;on({ vclick: closePopup( options&#46;onCancel ) });
$dlg&#46;find( '&#46;dlg_caption' )&#46;text( caption '' );
$dlg&#46;find( '&#46;dlg_title' )&#46;text( title '' );
$dlg&#46;find( '&#46;dlg_text' )&#46;text( text || '' );
$dlg&#46;popup( "open" );
}/code/pre


jquery popup as confirmation

Posted: Mon Feb 03, 2014 1:22 pm
by ciccio

thank you it works.
but now i'm having another problem:
i have a popup (added by appery like a new page) with a select component.
i would like to add a jquery popup on a particular selected value.

on the select value change event i added:
codevar stato2 = Appery('select_stato')&#46;val();
if (stato2 == "exit"){
MessageDialog( 'MyAppName', 'Alert Text', false, {
onOK: function() { /* useful code / },
onNO: function() { / useful code */ }
} );
}/code

but i get 500 (Error Executing Database Query.) on the console

if i use
codeif (stato2 == "exit"){
alert('Ciao');
}/code

i get the alert.

and if i add a new button and on a click event i run the same js i run on the select value change event
codevar stato2 = Appery('select_stato')&#46;val();
if (stato2 == "exit"){
MessageDialog( 'MyAppName', 'Alert Text', false, {
onOK: function() { /* useful code / },
onNO: function() { / useful code */ }
} );
}/code

i get the correct jquery popup.

why i get the error by running the code on the select component value change event?
how i can solve the problem?