Results 1 to 3 of 3

Thread: Unable to submit from combo after myForm.getForm().setValues();

  1. #1
    Ext JS Premium Member
    Join Date
    Apr 2009
    Vote Rating

    Default Unable to submit from combo after myForm.getForm().setValues();


    I have a combo box of client customer names connected to a remote store that contains... maybe a few hundred records. Too big to preload. But my form also has an "account number" box that when the account number is typed in, and the "lookup" button is pressed, it automatically populates all the form fields. --And this is working great; except...

    When I load my form I populate the comboBox id with the index value, and the hiddenValue with the appropriate index value. But, when I try to resubmit the form, the value coming back is null.

    I'm thinking that even though the display value is being loaded, the hiddenValue isn't. So, even though the combo has the right text, it's not been actually "selected" and so, when it goes to submit it chokes.

    I *suppose* I could rewrite my submission action on the back end to take the display value, and then use that as a key to lookup the correct index value in the database, but... it doesn't seem like I should have to do that when I know the combo box should be able to submit the index in the first place...

    Anyone have any ideas? Is this how things are supposed to work? Or, am I be dense and probably missing something obvious?

    Code snippets below:

    My action:
    $n = array();
    $n['title'] = $r->title;
    $n['description'] = $r->description;
    $n['notes'] = $r->notes;
    $n['arrival_date'] = $r->arrival_date;
    $n['provider_id'] = $r->provider_id; //loads the id into the combo
    $n['provider'] = $this->getFullNameByID($r->provider_id); //loads the text too!
    $data =trim (CJSON::encode( $n ), "[]");  // removes unnecessary brackets
    echo "{success:true,data:$data}"; // push payload into a "data" element in a JSON string.
    My JavaScript load form ajax:

    Ext.getCmp("btnLookup").on('click', function() {
                method: 'POST',
                url: 'index.php?r=inventory/getCustomerByID',
                timeout: 60000,
                params: {
                    id: f.findById("uid").getValue(),
                success: function(result, request) {
                    var jsonData = Ext.util.JSON.decode(result.responseText);
                    var data =;
    The Ext field definition:
    dataProvider = function() {
            return {
                bodyStyle: 'padding:0 5px',
                layout: 'form',
                labelAlign: 'left',
                defaults: {
                    anchor: '100%'
                items: [{
                    labelWidth: 55,
                    fieldLabel: 'Data Provider',
                    id: 'provider',
                    xtype: 'combo',
                    editable: false,
                    triggerAction: 'all',
                    typeAhead: false,
                    hideTrigger: false,
                    loadingText: 'Searching...',
                    mode: 'remote',
                    minChars: 2,
                    store: this.nameStore,
                    displayField: 'val',
                    hiddenName: 'provider_id',
                    valueField: 'id'

  2. #2
    Sencha User
    Join Date
    Mar 2008
    Vote Rating


    what value is coming back as null? Do you have a hidden field on the form?

  3. #3
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    The Netherlands
    Vote Rating


    1. Your form is not using the 'provider' property. The combobox is using it's own store to get the name for the specified provider_id.
    2. If you want the combobox to post the provider name too then you should configure it with:
    name: 'provider',
    submitValue: true

Similar Threads

  1. [Solved]FormPanel.getForm().setValues not work?
    By Christian Mueller in forum Ext 2.x: Help & Discussion
    Replies: 11
    Last Post: 15 Apr 2013, 3:41 AM
  2. [SOLVED] getForm().setValues() from a data.Store
    By ExtKD in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 15 Mar 2010, 3:58 AM
  3. [2.0??] FormPanel.getForm().setValues() not working...
    By digiboy21c in forum Ext 2.x: Bugs
    Replies: 6
    Last Post: 2 Oct 2008, 9:07 AM
  4. Can't submit my form (win.getForm() is not a function)
    By michiel in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 23 Jun 2008, 7:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts