1. #1
    Ext User
    Join Date
    Feb 2008
    Location
    Germany, Cologne
    Posts
    1
    Vote Rating
    0
    mette is on a distinguished road

      0  

    Default ComboBox - Select an Item or enter a new one

    ComboBox - Select an Item or enter a new one


    Hello,

    I try to create a combobox which 'send' the content of the valueField if the user select an item of the list or - if the user enter a not-listed new entry - I want to get the displayField.

    If a user select a listed item I want to save the 'id' of this item. If the user is type a new entry I want to save this new one the Look-Up-Table of the combobox. For example: The user should be able to select a country or type a new one.

    The combobox use a Json-Data-Store. How to configure the combobox in this case?
    Thanks!

  2. #2
    Sencha User catacaustic's Avatar
    Join Date
    Jul 2007
    Location
    "A Land Down Under"
    Posts
    618
    Vote Rating
    1
    catacaustic is on a distinguished road

      0  

    Default


    All you should need to do is set 'forceSelection: false' and 'editable: true' in the ComboBox's config, and it will allow you to do what you're after. If a menu option is chosen, it'll send whatever that options value is, but if a new option is entered, it sends that option instead.
    'Once again, fortune vomits on my eiderdown'
    - Edmund Blackadder

  3. #3
    Ext User
    Join Date
    Oct 2007
    Posts
    38
    Vote Rating
    0
    Makor is on a distinguished road

      0  

    Default


    'forceSelection: false' and 'editable: true' works only if combobox not have hidden box and ValueField - it dont send typed value, only data from value field of store or none if none was selected previously...

    PHP Code:
    {
                              
    id 'idCountry2',
                              
    xtype'combo',
                              
    triggerAction'all',
                              
    width:200,
                            
    fieldLabel'Country',
                            
    editabletrue,
                              
    emptyText'Celect country',
                              
    forceSelection:false,
                              
    storerDs,
                              
    mode:'local',
                              
    displayField'countryName',
                              
    valueField'id',
                              
    hiddenName:'idCountry',
                              
    lazyRender:true
                         

    this combo send only id of selected country/ but i want to send country if it not in list - to save into DB.

  4. #4
    Sencha User genius551v's Avatar
    Join Date
    Mar 2007
    Posts
    287
    Vote Rating
    0
    genius551v is on a distinguished road

      0  

    Default


    Makor, mette, any progress on this issue?

  5. #5
    Ext User
    Join Date
    Dec 2007
    Posts
    2
    Vote Rating
    0
    Algorithms is on a distinguished road

      0  

    Default


    Is this possible? I would like to do the same thing and haven't found a clean solution. At the moment I am considering using the lastQuery property that gets set to manually get the hiddenField value on submit, but that is ugly.

    Here is my current work around. Not sure how "safe" it is, but it does the trick. In the submit handler, before I call form.submit() I perform this on the form. Since lastQuery resets when they select a topic from the drop down, it will be empty unless they've typed in something. Then you can set it and store/update server side as desired.

    Code:
    			var topic = NoteForm.form.items.map.topiccombo.lastQuery;
    			if (topic) { NoteForm.form.items.map.topiccombo.hiddenField.setValue(topic); }

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar