2011-08-09 6 views
0

응용 프로그램에는 웹 서비스에 게시해야하는 FormPanel이 있습니다.Ext.form.FormPanel이 null 값을 게시하는 이유는 무엇입니까?

다음과 같이 FormPanel을 배치했습니다.

var config = { 
    // Url for the Web Service - Note that the WebServiceURL MUST end with a trailing "/" 
    WebServiceUrl: 'http://webservice.example.com/' 
}; 

function WebService(controller, action) { 
    return(config.WebServiceUrl + controller + '/' + action); 
}; 

rpc.views.Contact.CommunicateCard = new Ext.form.FormPanel({ 
    items: [{ 
     xtype: 'fieldset', 
     id: 'loginFormSet', 
     title: '', 
     items: [ 
      { 
       xtype: 'emailfield', 
       placeHolder: 'Username', 
       name: 'Username', 
       id: 'Username', 
       required: true 
      }, { 
       xtype: 'passwordfield', 
       placeHolder: 'Password', 
       name: 'Password', 
       required: true 
      }, { 
       xtype: 'checkboxfield', 
       id: 'RememberMe', 
       name: 'RememberMe', 
       label: 'Save login?', 
       labelWidth: '40%' 
      }, 
      { 
       xtype: 'button', 
       text: 'Login', 
       ui: 'confirm', 
       style: 'margin:2%;', 
       handler: function() { 
        doLogin(); 
       } 
      } 
     ] 
    }] 
}); 


var doLogin = function() { 
    Ext.Ajax.request({ 
     url: WebService('GetInTouch', 'CommunicateCard'), 
     method: 'post', 
     params: { UserName: rpc.views.Contact.CommunicateCard.getValues().Username, Password: rpc.views.Contact.CommunicateCard.getValues().Password, RememberMe: Ext.getCmp('RememberMe').isChecked() } 
    }); 
}; 

문제는 내가 누를 때 "제출"을 Fiddler/Charles의 게시물을보고, 나는 어떤 형태의 값을 볼 수 없다는 것입니다. 또한, 내 웹 서비스 요청을 받으면 양식 값을받습니다. webservice.example.com
리퍼러 : http://192.168.5.206/ 액세스 제어 - 요청 - 방법 : 여기

찰스

옵션/GetInTouch/CommunicateCard HTTP/1.1
호스트에서 HTTP 응답의 POST
출처 : http://192.168.5.206
사용자 에이전트 : Mozilla/5.0 (Macintosh, Intel Mac OS X 10_7_0) AppleWebKit/534.24 (Gecko와 같은 KHTML) Chrome/11.0.696.71 Safari/534.24
액세스 제어 - 요청 - 헤더 : X-요청-으로, 콘텐츠 유형
수락 : /
수락 - 인코딩 : gzip으로는, 폐, SDCH
을 수락 - 언어 : EN-US, 욕실, Q = 0.8
수락-캐릭터 세트를 : ISO-8859-1, UTF-8, Q = 0.7, *, Q = 0.3

내가
http://mhelpdesk.com/simple-login-form-using-asp-net-mvc-and-sencha-touch/ 여기에서 내 방향의 일부를 수행하기 위해 노력하고있어


Chrixian의 대답에 따르면, 나는 또한 다음과 같은 결과를 가진 코드를 시도했다.

rpc.views.Contact.CommunicateCard = new Ext.form.FormPanel({ 
    items: [{ 
     xtype: 'fieldset', 
     id: 'loginFormSet', 
     title: '', 
     items: [ 
      { 
       xtype: 'emailfield', 
       placeHolder: 'Username', 
       name: 'Username', 
       id: 'Username', 
       required: true 
      }, { 
       xtype: 'passwordfield', 
       placeHolder: 'Password', 
       name: 'Password', 
       required: true 
      }, { 
       xtype: 'checkboxfield', 
       id: 'RememberMe', 
       name: 'RememberMe', 
       label: 'Save login?', 
       labelWidth: '40%' 
      }, 
      { 
       xtype: 'button', 
       text: 'Login', 
       ui: 'confirm', 
       style: 'margin:2%;' 
      } 
     ], 
     submit: { 
      url: WebService('GetInTouch', 'CommunicateCard'), 
      waitMsg: 'submitting', 
      success: function(form, response, responseText) { }, 
      failure: function(form, response, responseText) { } 
     } 
    }] 
}); 

답변

1

붙여 넣은 HTTP 요청은 POST 중이 아니며 HTTP 메소드의 "OPTIONS"라고 말합니다.

FormPanel에 잘못된 구문을 전혀 볼 수 없으며 doLogin 함수는 params에서 정의하는 3 가지 정보를 실제로 게시합니다 ... 나는 당신이 무엇을 반환하는지 알지 못합니다. 당신이 그 기능을 게시하지 않았 으면 WebService('GetInTouch', 'CommunicateCard')에있는 URL. 또한

,이 양식을 제출 Ext.Ajax를 사용하여 아무 문제가 없다는은 FormPanel이 같은 일을 달성하기 Ext.Ajax에 대한 바로 가기를 제공한다 ...

rpc.views.Contact.CommunicateCard.submit({ 
    url: 'someurl', 
    waitMsg: 'submitting', 
    success: function(form, response, responseText) { ... }, 
    failure: function(form, response, responseText) { ... } 
}); 

그래서 당신이 그것을 할 수 있습니다 게시물에 항목을 추가하는 무거운 짐을 듭니다.

+0

나는 편집을 게시했습니다. –

+0

좋아, 그냥 URL을 반환 .. 나중에 .. 코드가 앉아 지금 당신이 그것을 기대하고 무엇을해야합니다. 내 대답을 추가 할 수 있습니다 .submit() 메서드를 시도 할 수 있지만 필자가 POST (POST)가 아닌 OPTIONS 요청에 대한 헤더를 붙여 넣었다 고 언급했기 때문에 Fiddler를 다시 살펴보십시오.요청은 생산할 것입니다.) OPTIONS 요청을 생성하는 것이 무엇인지 모르겠다. 나는 Fiddler 나 Charles를 사용하지 않았으므로 그 결과가 프록시의 결과인지 아닌지에 대해서는 언급 할 수 없다. – chrixian

+0

예, 살펴 본다. 내 편집 된 질문, 당신은'.submit()'함수를 사용하고있는 것을 볼 수 있지만, 같은 결과를 반환합니다. 여기서 무슨 일이 일어나고 있는지 확실하지 않습니다. –

관련 문제