2013-05-29 3 views
0

나는 사용자 편집 양식을 가지고 있습니다. 양식은 다음 코드로 Json 상점에서로드됩니다.양식을 제출하지 않았습니다.

var store = Ext.create('cp.store.form.Paciente',{}); 
    store.load({params:{idUsuario: idPaciente}}); 
    var form = Ext.create('cp.view.form.EditPaciente',{ 
     action: 'bin/paciente/modificar.php' 
    }); 
    // note: write this lines in the controller 
    form.on('afterrender',function(form,idPaciente){ 
     form.getForm().loadRecord(store.first()); 
     form.getForm().findField('idUsuario').setValue(idPaciente); 
    }); 
    var win = Ext.create('cp.view.ui.DecoratorForm',{ 
     aTitle: 'Editar paciente', 
     aForm: form 
    }); 
    win.show(); 

로드 코드가 올바르게 작동합니다. 제출 코드는 다음과 같습니다.

var me = this; 
    console.log('Submit...'); 
    console.log(this.url); 
    // WHY NOT SUBMIT !!!! 
    this.getForm().submit({ 
     console.log('submit !'); 
     success: function(form,action){ 
      if(action.result.success === true){ 
       Ext.create('cp.view.ui.AlertOk',{mensaje:action.result.msg}).showDialog(); 
       me.up('decoratorForm').close(); 
      }else{ 
       Ext.create('cp.view.ui.AlertErr',{mensaje:action.result.msg}).showDialog(); 
      } 
     } 
    }); 

제출 코드가 실행되기 시작합니다. FireBug는 첫 번째와 두 번째 "console.log"를 표시하고 "this.url"값은 정확합니다. 그러나 세 번째 "console.log"는 실행되지 않으며 양식이 서버로 전송되지 않습니다. "this.url"값에 대해 Firebug에서 404 오류를 표시하지 않습니다. 아이디어가 있으십니까? 감사합니다. 당신은 객체 리터럴 내부 로그 문을 넣어 캔트

Ext.define('cp.view.form.EditPaciente',{ 
    extend: 'Ext.form.Panel', 
    alias: 'widget.editPaciente', 


    bodyPadding: '5px 5px 5px 5px', 
    bodyStyle: 'border: none', 
    fieldDefaults: { 
     labelWidth: 65, 
     labelAlign: 'top' 
    }, 

    initComponent: function(){ 
     this.url = this.action, 
     this.method = 'POST', 
     this.items = [ .... ] 
     this.callParent(arguments); 
    } 
}); 
+0

URL이이 스크립트 외부에서 액세스 할 때 작동합니까? 404는 404 ... 또한, 세 번째 console.log()는 구문 적으로 잘못된 위치에 배치 했으므로 실행되지 않습니다. submit()에 전달 된 options 인수는 Object입니다. – existdissolve

+0

@existdisslove mmm 서버 측 스크립트가 응용 프로그램 외부에서 실행됩니다. url을 사용하여 액세스 : http : //sigetumed.cp/bin/paciente/modificar.php 및 "{ 'success': false, 'msg': 'Faltan llenar campos obligatorios'}"화면에 표시하십시오. 좋다. 아래에서 내 양식 정의를 게시하십시오. – ramiromd

+0

양식의'submitUrl'을 확인해야합니다. 문제가 있습니다. 또한 폼에 'url'과 같은 속성이 있는지 확인하십시오. 나는 그렇게 생각하지 않는다. [API] (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.Panel)를 다시 확인하십시오. – talha06

답변

0

:

은 양식 정의를 추가합니다.

submit({        <-- This is an object literal 
      console.log('submit !'); <-- This can not be in an object literal 
      success: function(form,action){ 
       if(action.result.success === true){ 
        Ext.create('cp.view.ui.AlertOk',{mensaje:action.result.msg}).showDialog(); 
        me.up('decoratorForm').close(); 
       }else{ 
        Ext.create('cp.view.ui.AlertErr',{mensaje:action.result.msg}).showDialog(); 
       } 
      } 
     }); 
관련 문제