EasyUI Forum
May 05, 2024, 04:38:14 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: $.messager.prompt Ok and Cancel callback  (Read 7591 times)
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« on: October 18, 2016, 02:18:36 AM »

Where is $.messager.prompt Ok and Cancel callback

because on documentation i only found fn(val): The callback function with a value parameter user entered.

how to detect if Ok button pressed? thank you in advance
Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: October 18, 2016, 08:32:21 PM »

Please try this code:
Code:
$.messager.prompt('My Title', 'Please type something', function(r){
if (r === undefined){
console.log('press cancel');
} else {
console.log('press ok')
}
});
Logged
iLLuSia
Newbie
*
Posts: 12


View Profile Email
« Reply #2 on: August 30, 2020, 03:12:03 PM »

I wanted 3 possibilities and experimented a bit, so in case someone is ever interested in this:

Code:
$.messager.prompt('My Title', 'Please type something', function(r){
if (r) {
console.log('ok clicked, r = '+r);
} else if (r == undefined) {
console.log('cancel clicked');
} else if (r.localeCompare("")==0) {
console.log('ok clicked, but r is EMPTY');
}
});
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!