Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is my Ext.form.FormPanel posting null values?
    text
    copied!<p>In my <a href="/questions/tagged/sencha-touch" class="post-tag" title="show questions tagged 'sencha-touch'" rel="tag">sencha-touch</a> application, I've got a <code>FormPanel</code> that is supposed to post to my web service.</p> <p>I've got my FormPanel laid out as follows.</p> <pre><code>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() } }); }; </code></pre> <p>The problem is that when I press "submit" and watch the post in <a href="http://www.fiddler2.com/fiddler2/" rel="nofollow">Fiddler</a>/<a href="http://www.charlesproxy.com/" rel="nofollow">Charles</a>, I don't see any form values. Also, when my web service receives the request, it doesn't receive the form values either.</p> <p>Here's the HTTP Response from Charles</p> <blockquote> <blockquote> <p>OPTIONS /GetInTouch/CommunicateCard HTTP/1.1<br> Host: webservice.example.com<br> Referer: <a href="http://192.168.5.206/" rel="nofollow">http://192.168.5.206/</a> Access-Control-Request-Method: POST<br> Origin: <a href="http://192.168.5.206" rel="nofollow">http://192.168.5.206</a><br> User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.71 Safari/534.24<br> Access-Control-Request-Headers: X-Requested-With, Content-Type<br> Accept: <em>/</em><br> Accept-Encoding: gzip,deflate,sdch<br> Accept-Language: en-US,en;q=0.8<br> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 </p> </blockquote> </blockquote> <p>I'm trying to take some of my direction from here<br> <a href="http://mhelpdesk.com/simple-login-form-using-asp-net-mvc-and-sencha-touch/" rel="nofollow">http://mhelpdesk.com/simple-login-form-using-asp-net-mvc-and-sencha-touch/</a></p> <hr> <p>as per Chrixian's answer, I also tried the following code with the same results.</p> <pre><code>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) { } } }] }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload