code_junkie

How to create a custom “confirm” & pause js execution until user clicks button?

Nov 12th, 2011
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. function buttonEventHandler() {
  2.  
  3. if (condition1) {
  4. if(!showConfirmForCondition1) // want execution to pause while waiting for user response.
  5. return; // discontinue execution
  6. }
  7.  
  8. if (condition2) {
  9. if (!showConfirmForCondition2) // want execution to pause while waiting for user response.
  10.  
  11. return; // discontinue execution
  12. }
  13.  
  14. if (condition3) {
  15. if (!showConfirmForCondition3) // want execution to pause while waiting for user response.
  16.  
  17. return; // discontinue execution
  18. }
  19.  
  20. ...
  21. }
  22.  
  23. function BeforeDelete(controlUniqueId) {
  24. confirmPopup('question...?', function() { __doPostBack(controlUniqueId, ''); });
  25. return false;
  26. }
  27.  
  28. function confirmPopup(message, okCallback) {
  29. $('#popup-buttons-confirm').click(okCallback);
  30. // set message
  31. // show popup
  32. }
Add Comment
Please, Sign In to add comment