1. #1
    Ext User
    Join Date
    Nov 2010
    Location
    Mexico City
    Posts
    6
    Vote Rating
    0
    2000Rivets is on a distinguished road

      0  

    Exclamation Help; it doesn't work submit on FormPanel on sencha Touch

    Help; it doesn't work submit on FormPanel on sencha Touch


    Hi there, I've been reading all the past posts related to this point and I've tried each without any success; here's my problem; I'm trying to make a submit form using FormPanel and SenchaTouch I've tried using the Ajax.request, and it goes to my action but allways fails, I defined a listener for submit event and one for exception event my action is always executed and returned "{success:true}" but for the safari side is always an exception any idea how can I catch the JSON string I'm sending from my action?

  2. #2
    Ext User
    Join Date
    Nov 2010
    Location
    Mexico City
    Posts
    6
    Vote Rating
    0
    2000Rivets is on a distinguished road

      0  

    Default


    Here's my code:
    Code:
    var formAgenda = new Ext.form.FormPanel({
    	fullscreen: true,
    	id: 'contact1', 
    	name: 'contact1',
        title:'Agenda',
        iconCls: 'favorites',
        defaults:{
    		labelWidth: '400px'
    	},
        items: [
            {
                xtype: 'textfield',
                name : 'name',
                id : 'name',
                label: 'Name',
                useClearIcon: true,
                placeHolder: 'Debe introducir su nombre', //<-- enter your name 
                emptyText: 'Debe introducir su nombre',
                blankText: 'Debe introducir su nombre'
                
            },
            {
                xtype: 'textfield',
                name : 'appat',
                id : 'appat',
                useClearIcon: true,
                label: 'Apellido paterno' //first name :D
            },
            {
                xtype: 'textfield',
                name : 'apmat',
                id : 'apmat',
                useClearIcon: true,
                label: 'Apellido materno' // lastname
            },
            {
                xtype: 'numberfield',
                name : 'url',
                id : 'url',
                useClearIcon: true,
                label: 'Telefono' //Phone number
            },
            {
                xtype: 'emailfield',
                name : 'email',
                id : 'email',
                label: 'Email',
                placeHolder: 'you@domain.com',
                useClearIcon: true
            }, 
            {
                xtype: 'fieldset',
                title: 'Seleccione el tipo de cita', //select date type
                items: [{
                    xtype: 'selectfield',
                    name: 'options',
                    id: 'options',
                    options: [
                        {text: 'Showroom Df',  value: '1'},
                        {text: 'Showroom Gdl', value: '2'},
                        {text: 'Visita a domicilio', value: '2'} //home visit
                    ]
                }]
            },
            {
                xtype: 'datepickerfield',
                name : 'fecha',
                id : 'fecha',
                label: 'Fecha',
                picker: { yearFrom: new Date().getFullYear(), yearTo: new Date().getFullYear() + 2 }
            },{
            	xtype: 'textfield',
                name : 'hoora',
                id : 'hoora',
                label: 'Hora',
                disabled: true
            },slider,
            {
                xtype: 'textareafield',
                name : 'observaciones',
                id : 'observaciones',
                labelAlign: 'bottom',
                label: 'Observaciones'
            },
            {
                xtype: 'button',
                name : 'enviar',
                id : 'enviar',
                text: 'Enviar',
                ui: 'action',
                handler: caller2,
     
            }
        ],
        listeners : {
           submit : function(form, result){
    		alert('inside submit'); //<-- never enters here
            },
            exception : function(form, result){       //<-- always enters here
            	Ext.Msg.alert('Status', 'exception.' + result.responseText);
                console.log('failure', Ext.toArray(arguments));
            }
        }
    });
    here's my "caller2" code
    Code:
    var caller2= function(){
    
        formAgenda.submit({
        	url : externalProject path'+'/guardaAgendaCita.action,
        	scope: formAgendacitas,
            success: function(r, o){
            var obj = Ext.decode(r.responseText);
            console.dir(obj);
            if (obj.success === 'true') {
                // Do something...
            	Ext.Msg.alert('Status', 'Success:' + result.responseText);
            }
            else {
               // Do something else...
            	Ext.Msg.alert('Status', 'Failue:' + result.responseText);
    
            }
        },callback:function(callbackOptions, success, response) {
            //this.hideMask();
            var obj = Ext.decode(response.responseText);
            console.dir(obj);
    
            if (success) {
                response = Ext.decode(response.responseText);
                success = !!response.success;
                if (success) {
                    if (typeof options.success == 'function') {
                    	Ext.Msg.alert('Status', 'Success:' + result.responseText);
                    }
                }
            }else{
                    if (obj.success === 'true') {
                        // Do something...
                    	Ext.Msg.alert('Status', 'Success:' + result.responseText);
                    }
                    else {
                       // Do something else...
                    	Ext.Msg.alert('Status', 'Failue:' + result.responseText);
                    }
            }
    
            }
        
        });
      };
    never enters here I don't know why
    also I've tried this way:

    Code:
    var llamada = function(){
    	
    	var realizaEnvioAjax = new Ext.data.Connection({ });
    
    		realizaEnvioAjax.request({
       	    	url: "./fake.jsp",  //here's just a  <script type="text/javascript">document.writeln('{success:true}');</script>
       	    	success: function(form, result){
    			//var respuestaServer = Ext.util.JSON.decode(result.responseText);
            	alert('sucess; '+ result.responseText);
            	formAgenda.submit({
        			url: 'externalProject path'+'/guardaAgendaCita.action',
        			method:'post',
        			scope:this,
                    waitMsg : {message:'Submitting', cls : 'demos-loading'},
                    success: function(form, result){
                    	alert('sucess; '+ result.responseText);                   	
                    },
        			failure: function(form, result){
                    	alert('failure; '+ result.responseText);                   	
                    }
                });
            },
    		failure: function(form, result){
            	alert('failure; '+ result.responseText);                   	
            }
    	});
       };
    Is not working for me the "code" button sorry for that, it's easier to use EXTjS 3 for this submit but i just cannot make this works as it should, I've been stocked here for a coupple of days, I hope you could help me.

    Thanks a lot guys!!

  3. #3
    Ext User
    Join Date
    Nov 2010
    Location
    Mexico City
    Posts
    6
    Vote Rating
    0
    2000Rivets is on a distinguished road

      0  

    Default


    ok. I found the answer by myself after trying so many times with different courses, there's an strange way and don't excecute an external resource call. I was making an external project and server project call this was not recognizable for the FormPanel, as soon as I used an internal resource (Servlet in my case) it finally works as I needed. It was supposed to excecute any URL whatever it be internal or external, wasn't it? anyway the fact is this working, I just addded this post if anyone's trying to do the same as I was trying to. thanks anyway for the one who had read my post

  4. #4
    Sencha User
    Join Date
    Apr 2013
    Location
    Karachi, Pakistan
    Posts
    9
    Vote Rating
    0
    ali.abbas is on a distinguished road

      0  

    Default


    Same thing is happening to me. Someone from sencha team should response to it.

Similar Threads

  1. Sample code to submit a Sencha Touch form?
    By profunctional in forum Sencha Touch 1.x: Discussion
    Replies: 11
    Last Post: 12 Apr 2012, 9:11 PM
  2. Could Ext Js and Sencha Touch work together?
    By handitan in forum Sencha Touch 1.x: Discussion
    Replies: 3
    Last Post: 26 Apr 2011, 1:25 PM
  3. How-To Submit Login Form with ASP.NET MVC and Sencha Touch
    By profunctional in forum Sencha Touch 1.x: Examples and Showcases
    Replies: 1
    Last Post: 13 Feb 2011, 6:47 PM
  4. Sencha Touch - How function work?
    By Riaz in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 30 Sep 2010, 8:30 PM
  5. <ul><li> doesn't render in Sencha Touch panel?
    By JacobGu in forum Sencha Touch 1.x: Discussion
    Replies: 3
    Last Post: 19 Aug 2010, 12:55 PM

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar