Results 1 to 4 of 4

Thread: combobox submit value issue, DESPERATE for an answer

  1. #1
    Sencha User
    Join Date
    May 2010
    Posts
    25

    Default combobox submit value issue, DESPERATE for an answer

    Hi,
    I have a form with combo (hiddenName como).
    the form load its data from the server and set the "selectedValue" automatically.
    the combo load its value from the server before the form loads its data.
    If I click on submit, the display will be sent to the server instead if the value even though i set the hiddenName.
    but if i change the combo value, from now and on it will submit the value and not the display, as expected.
    Y the initial value that was set by the form prevents the combo to submit its value...?

    this is the combo and the store:
    Code:
    var store = new Ext.data.JsonStore({
            autoLoad: true,
            url: config.url,
            root: 'data',
            methos:'POST',
            fields:[{name:'userManager_employeeId'},{name:'userManager_userName'}] });
    
        var combo  = new Ext.form.ComboBox({
            hiddenName:'userManager',
            valueField: 'userManager_employeeId',
            displayField: 'userManager_userName',
            forceSelection: true,
            mode: 'remote',    
            typeAhead: true,
            lazyInit :false,
            lazyRender:false,
            fieldLabel:     config.title,
            emptyText:'Select a value',
            roles:config.roles,
    this is the form data:

    Code:
    {"data":[{"employee_employeeId":3,"Affiliate_affiliateId":8,"parent_affiliateId":8,"userManager_employeeId":1,"Affiliate_email":"[email protected]","parent_name":"First Affiliate","userManager":"admin","Affiliate_name":"First Affiliate","user_userName":"admin","user_userId":1}]}

    this is the combo data:

    Code:
    {"data":[{"userManager_userName":"admin","userManager_employeeId":3},{"userManager_userName":"admin2","userManager_employeeId":4}]}
    this is the form reader:

    Code:
    reader: new Ext.data.JsonReader({
                root: 'data',
                fields: [{
                    name: 'userManager'
                }]
            })
    this is the form data:

    Code:
    {"data":[{"userManager":"admin"}]}
    I also tried:

    Code:
    {"data":[{"userManager":"1"}]}
    if the form data is "admin", I see in the display admin but the submitted value us admin
    but if the form data is "1", I see in the display "1" and in the submit value "1" How can i see in the display admin and submit the value ("1") Thanks

  2. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,199

    Default

    I dont know but yout reader seems a bit simple and your store contains field

    Maybe something like this

    Code:
    var datareader = new Ext.data.JsonReader({id: 'userManager_employeeId', totalProperty: 'total', 
        root: 'data', 
        succesProperty: 'success'},
        Ext.data.Record.create(
             [{name: 'userManager_employeeId', mapping: 'userManager_employeeId', type: 'int'},
              {name: 'userManager_userName', mapping: 'userManager_userName', type: 'string'}
             ]));
    
    
    
    var datastore = new Ext.data.Store({id:'datastore',
    reader:datareader,
    url: 'yourdataurl.jsn' 
    });
    
    
    var combo = new Ext.app.ComboBox({
    id:'mycombo',
    store:datastore,
    displayField: 'userManager_userName',
    valueField: 'userManager_employeeId',
    mode: 'local',
    triggerAction: 'all'
    });

  3. #3
    Sencha User
    Join Date
    Jul 2008
    Posts
    85

    Default

    Hello, Please check your combo data:

    Code:
    {"data":[{"userManager_userName":"admin","userManager_employeeId":3},{"userManager_userName":"admin2","userManager_employeeId":4}]}
    You only have 2 records, and the ID is 3 or 4, not 1, you should set the value of field userManager as 3 or 4 on the form data.

    Please try it,

    Kohyea

  4. #4
    Sencha User
    Join Date
    May 2010
    Posts
    25

    Default

    Thanks !!!
    It was a combination of all of you,
    Thanks again.

Similar Threads

  1. Custom Event Problem... desperate newbie!
    By mrtedweb in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 18 Dec 2009, 2:24 PM
  2. Add TextField or ComboBox depending on server answer
    By Saladir in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 6 Aug 2009, 4:04 PM
  3. Desperate with getting Radiobuttons in a Row
    By iveo in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 3 Jun 2008, 2:55 AM
  4. Form submit with worng answer
    By semo in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 18 Jan 2008, 1:47 AM

Tags for this Thread

Posting Permissions

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