Results 1 to 5 of 5

Thread: 2x ComboBox Bugs

  1. #1
    Sencha User
    Join Date
    Apr 2007
    Posts
    68
    Vote Rating
    0
      0  

    Default 2x ComboBox Bugs

    Bug1:
    When using hiddenName, if you type in a value that is not one of the drop-down values (from store), it does not submit the typed in value, it submits either an empty value or whatever the last selected value was (see bug2).

    Bug2:
    1. Form has ComboBox, forceSelection is false.
    2. Select a value
    3. Change your mind and delete the value.
    4. emptyText is again displayed
    5. When submitted it sends the last value you selected


    I tested this in 1.0.1a and 1.1-beta2

    Code:
    titleStore = new Ext.data.SimpleStore({
      fields: ['value','text'],
      data: [['Mr.','Mr.'], ['Ms.','Ms.'], ['Mrs.','Mrs.'], ['Miss','Miss']]
    });
    
    new Ext.form.ComboBox({
       name: 'titleCB',
       hiddenName: 'title',
       fieldLabel: 'Title',
       store: titleStore,
       displayField: 'text',
       valueField: 'value',
       typeAhead: true,
       mode: 'local',
       triggerAction: 'all',
       emptyText: 'Type or Select...',
       selectOnFocus: true
    })

  2. #2
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    19
      0  

    Default

    Not sure if this is really a bug or just not being handled for you by Ext.

    You have a displayField and a valueField. This creates a hidden input, that input is not cleared by 'blanking' the field.

    I fix mine when I validate with:

    combo.on('valid', function(field) {
    if (field.getValue() == '') {
    field.setRawValue('');
    }
    });

    You could catch a different event or do it before you post.

  3. #3
    Ext User violinista's Avatar
    Join Date
    Apr 2007
    Location
    Serbia
    Posts
    293
    Vote Rating
    0
      0  

    Default

    I think it MUST be fixed by setting a hiddenName property, and it's considered good practice among many Ext's developers. Go search forum with "combo hiddenName".
    "It is better to be young, pretty and rich instead old, ugly and poor."
    (c) Alan Ford.

  4. #4
    Sencha User
    Join Date
    Apr 2007
    Posts
    68
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by JCA View Post
    I fix mine when I validate with:

    combo.on('valid', function(field) {
    if (field.getValue() == '') {
    field.setRawValue('');
    }
    });
    This doesn't fix it... it is still submitting whatever the last selected value was if one was selected, if one was not selected and you try to type in a value, it just blanks the field.

    I'll have to remove the emptyText config for now since that is why I was forced to use hiddenName field which I guess is bug #3.

  5. #5
    Sencha User
    Join Date
    Mar 2007
    Posts
    186
    Vote Rating
    0
      0  

    Default

    Here is how I fixed Bug2:

    Code:
    Ext.form.ComboBox.prototype.onBlur = Ext.form.ComboBox.prototype.onBlur.createSequence(function() {
    	if (!this.store.getAt(this.view.getSelectedIndexes()[0]) || !this.getRawValue()) {
    		this.selectedIndex = -1;
    		if (this.hiddenField) {
    			this.hiddenField.value = '';
    		}
    	}
    });

Posting Permissions

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