Hybrid View

  1. #1
    Ext JS Premium Member
    Join Date
    Apr 2009
    Posts
    4
    Vote Rating
    0
    cshamis is on a distinguished road

      0  

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

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


    All:

    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:
    Code:
            
    $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:

    Code:
    Ext.getCmp("btnLookup").on('click', function() {
            Ext.Ajax.request({
                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 = jsonData.data;
                    f.getForm().setValues(data);
                }
            });
        });
    The Ext field definition:
    Code:
    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
    Posts
    566
    Vote Rating
    0
    moegal is on a distinguished road

      0  

    Default


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

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    86
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    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:
    Code:
    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

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi