title: Extjs / Javascript - wait for MessageBox response before function return
body: <p>I'm working on a project with Extjs, version 4.0.7 and i have a problem.
  I have a function which verifies data validity before save. It looks like this:</p>
  
  <pre><code>        me.validateEmployeeSystemSettingsOnSave = function (a,b,c) { 
             switch (c) {
          case 1:{
           if(expression)
             return {success: false}
             if(expression2){
             Ext.Msg.show({
                  title:'',
                      msg:'',
                  buttons: Ext.Msg.YESNO,
                  icon: Ext.Msg.QUESTION,
                  fn: function (btn) {
                  if (btn == 'yes') {
                  return { success: true };
                  }
                  else if (btn == 'no') {
                  return { success: false};
                  }
                  },
                  modal: true
                   });
               }
  
        else return {success: true}; /*problem line*/ //this is the default answer, when function will 
  //not enter any expression and return {success: true} 
  
      }
      case 2:{
      }
      }
  </code></pre>
  
  <p>My above function is called in an onSave function like this:</p>
  
  <pre><code> var response = me.validateEmployeeSystemSettingsOnSave(dsa,ssa,daa){
     if(response.success){
  this.save();
  }
  else{
  }
  }
  </code></pre>
  
  <p>My question is:
  Is there any way to wait for the answer of the Ext.msg.show(), before reaching the default <code>return</code>, which i marked with /<em>problem line</em>/ ? 
  Because now the function doesn't take my yes or no answer, it always return <code>{success: 'true'}</code>, which is normal, taking into consideration how is the function structured.</p>
  
  <p>Any ideas? Thank you!</p>