Question

I'm using

Ext.getCmp('my_form').submit(
{
  url: 'http://does-not-respond.onion/',
  method : 'POST',
  waitMsg : 'Please wait...',
  timeout: 5,
  params :
  {  

The "Please wait" window doesn't disappear. How I can make it disappear and alert a message? I want it to disappear and show error message if the server does not respond, like the internets has gone away.

Was it helpful?

Solution

try checking the failureType on form action's failure

Ext.getCmp('my_form').submit({
  url     : 'http://does-not-respond.onion/',
  method  : 'POST',
  waitMsg : 'Please Wait...',
  timeout : 5,
  params  : {},
  success : function(){console.log('success...');},
  failure: function(form, action){
                if (action.failureType === Ext.form.action.Action.CONNECT_FAILURE) {
                    Ext.Msg.alert('Error',
                        'Status:'+action.response.status+': '+
                        action.response.statusText);
                }
            }
});

refer Ext.form.action.Action-property-failureType

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top