Note that there are some explanatory texts on larger screens.

plurals
  1. POIn ExtJS does getForm().load() load combo field values?
    text
    copied!<p>I have a form with a combo box in it. The combo box loads it's data via a Json store and I use form.getForm().load( url: 'URL') to load the forms data also from a Json store.</p> <p>When the data is loaded into the form I can see via Firebug that it receives the right value, the combo then displays the correct corresponding display value. When I look at the HTML in FireBug for the hiddenField it says the value="DISPLAYVALUE" not value="VALUE". When I then pick any value from the combo it changes to the correct value="VALUE".</p> <p>Of course if the user never changes the combo the wrong value is submitted. Is this by design/limitation or am I missing something.</p> <p>Do I really need to load and verify the data for each combo before I do the getForm().load()? wouldn't it make sense for load() to just load the complete data even if that means loading the data from a store?</p> <p>I've included simplified sample code that has the issue.</p> <pre><code> Ext.onReady(function(){ var frmClientRecord = { xtype: 'form', items: [ { fieldLabel: 'Advisor', xtype: 'combo', id: 'advisorName', displayField: 'Advisor', valueField: 'advisorId', hiddenName: 'advisorsId', mode: 'remote', store: new Ext.data.Store({ autoLoad: true, proxy: new Ext.data.HttpProxy({ url: '/referrals/index.php/advisors/read', method: 'POST' }), reader: new Ext.data.JsonReader({ root: 'results', fields: [ {name: 'advisorId'}, {name: 'Advisor'} ] }) }) } ] } frmClientRecordCmp = new Ext.FormPanel(Ext.apply(frmClientRecord)); frmClientRecordCmp.getForm().load({ url: '/referrals/index.php/clients/getbyid/100', }) frmClientRecordCmp.render(document.body); }); </code></pre> <p>JSON FOR THE COMBO</p> <pre><code>({"results":[{"Advisor":"Chris","advisorId":33},{"Advisor":"Fawzia","advisorId":2},{"Advisor":"Kent","advisorId":3},{"Advisor":"Rob","advisorId":4},{"Advisor":"Stephanie","advisorId":5}]}) </code></pre> <p>JSON FOR THE FORM</p> <pre><code>{success: true, data: {"advisorsId":33}} </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