Results 1 to 9 of 9

Thread: After requesting server crashes and EXTjs's failure does not send alert of failed

  1. #1
    Ext User
    Join Date
    Aug 2010
    Posts
    94
    Vote Rating
    0
      0  

    Default After requesting server crashes and EXTjs's failure does not send alert of failed

    After requesting server crashes and EXTjs's failure does not send alert of failed. Why?

    Code:
    function redireciona(){
    	window.location = "pessoas.action";
    }
    
    Ext.onReady(function() {
        var form = new Ext.FormPanel({
            renderTo: 'upload', 
            width: 890,
            height: 150,
            buttonAlign: 'center',
            frame: true, 
            fileUpload: true, 
            items:
            	[
                    {
    		                 xtype: 'fileuploadfield',
    		             emptyText: 'Selecione uma foto',
    		            fieldLabel: 'Foto 1',
    		            buttonText: 'Procurar',
    		                  name: 'imagemDoUsuario1',
    		                    id: 'form-file-1'
                    },
                    {
    		                 xtype: 'fileuploadfield',
    		             emptyText: 'Selecione uma foto',
    		            fieldLabel: 'Foto 2',
    		            buttonText: 'Procurar',
    		                  name: 'imagemDoUsuario2',
    		                    id: 'form-file-2'
                    },
                    {
    		                 xtype: 'fileuploadfield',
    		             emptyText: 'Selecione uma foto',
    		            fieldLabel: 'Foto 3',
    		            buttonText: 'Procurar',
    		                  name: 'imagemDoUsuario3',
    		                    id: 'form-file-3'
                    }
                ],     
            buttons: 
            	[
            	 	   {
    		            text: 'Importar',
    			            handler: function() {
    	        	 			form.getForm().submit({
    	        	 				method:'POST',
    			                    url: 'fazerUploadDeImagem.action', 
    			                    //waitMsg: 'Por favor aguarde... Importando a(s) foto(s)...',
    			           	 			
    			                  /*  success: function (form, o) {
    	        	 					Ext.Msg.show({
    		              	 			   title:'Upload de Foto - SGCS',
    		              	 			   msg: 'Upload feito com sucesso',
    		              	 			   buttons: Ext.Msg.OK,
    		              	 			   icon: Ext.MessageBox.OK
    	        	 					});      
    	        	 					
    	        	 					form.getForm().reset();
    		    	 				},*/
    			    	 				failure: function(form, o) {
    		    			  	 			alert('Upload de Foto - SGCS', 'Erro! Arquivo no formato invalido ou tamanho ultrapassa 2 MB (Mega Bytes)');
    		    			  	 			form.getForm().reset();		    			  				
    				              	 	}
    	        	 			});
    	        	 			if(true){
    			  	 				Ext.Msg.show({
    				  	 			    title:'Upload de Foto - SGCS',
    				  	 				msg: 'Upload feito com sucesso, por favor espere 3 segundos antes de clicar em ok.',
    				  	 				buttons: Ext.Msg.OK,
    				  	 				fn: redireciona, 
    				  	 				icon: Ext.MessageBox.INFO
    				  	 			});
    			      	 	   }
    	        	 	    }
            	 	    },
    	 		     {
    	                text: 'Limpar',
    		            handler: function() {
    		                form.getForm().reset();
    	 		        }
    		         }
    	      ]
        });
    });

  2. #2
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676
    Vote Rating
    9
      0  

    Default

    failure is only triggered when server sends success: false
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  3. #3
    Ext User
    Join Date
    Aug 2010
    Posts
    94
    Vote Rating
    0
      0  

    Default

    if an error happens inside the server? can't I use it failureType and get through SERVER_INVALID like above?

  4. #4
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676
    Vote Rating
    9
      0  

    Default

    explore it in firebug, do you see any response?
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  5. #5
    Ext User
    Join Date
    Aug 2010
    Posts
    94
    Vote Rating
    0
      0  

    Default

    no, I can't see anything... on firebug...

  6. #6
    Ext User
    Join Date
    Aug 2010
    Posts
    94
    Vote Rating
    0
      0  

    Default

    please suggest me anything...

  7. #7
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    118
      0  

    Default

    Unfortunately, a file upload can't signal a failure (see my feature request).

    Either implement the code from my request or use the success handler to analyse if the response is a failure.

  8. #8
    Ext User
    Join Date
    Aug 2010
    Posts
    94
    Vote Rating
    0
      0  

    Default

    Hey Condor, how's everything?
    Guy I've read your post about File Upload failure message however I didn't understand anything because I am total new in EXTjs... Could you tell me more how to set failure on my code below:


    Code:
    success: function (form, action) {
    	        	 				    alert('teste ok');
    	        	 					Ext.Msg.show({
    		              	 			   title:'Upload de Foto - SGCS',
    		              	 			   msg: 'Upload finalizado com sucesso',
    		              	 			   buttons: Ext.Msg.OK,
    		              	 			   fn: redireciona, 
    		              	 			   icon: Ext.MessageBox.OK
    	        	 					});      
    	        	 					form.getForm().reset();
    		    	 				},
    			                    failure: function(form, action) {
    		        	 				switch (action.failureType) {
    			        	 				case Ext.form.Action.SERVER_INVALID: alert('Upload de Foto - SGCS', 'Erro! Arquivo no formato invalido ou tamanho ultrapassa 2 MB (Mega Bytes)');
    			        	 				break;
    		        	 				}	
    		        	 				form.getForm().reset();		    			  				
    	        	 			    }
    	        	 			});
    Bye and thx for you attention.

  9. #9
    Ext User
    Join Date
    Aug 2010
    Posts
    94
    Vote Rating
    0
      0  

    Default

    Condor, in this case didn't signal failure and success? I am asking for it because didn't work success as well.

Similar Threads

  1. JS alert working fine but extjs alert not
    By sachin sachdeva in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 17 Dec 2010, 2:49 AM
  2. Replies: 3
    Last Post: 13 Sep 2010, 10:10 PM
  3. Send array from extjs to server
    By treblereel in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 27 May 2010, 2:42 AM
  4. [SOLVED] How to send a failed response on form load via json?
    By ruggerboy in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 29 Mar 2008, 4:30 AM
  5. Is there a way to get the response from server when action failed with Store
    By craneleeon in forum Ext 1.x: Help & Discussion
    Replies: 10
    Last Post: 8 Oct 2007, 10:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •