Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6363563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:03:14+00:00 2026-05-25T00:03:14+00:00

In ExtJs4, I have a form with a combo box, where the data gets

  • 0

In ExtJs4, I have a form with a combo box, where the data gets loaded from the database in json via

this.getForm().load({url: '/ext/get-patient', ...

where the user is allowed to enter a custom value besides the predefined ones, configured via the forceSelection attribute set to false.

The problem I experience is:

when the user selects any of the predefined values from the store in the combo box, saves and reloads the entry again, everything works fine.
But when the user enters a custom value (i.e. “abcde”) into the combo box field, saves (and I can see that the entered custom value is stored correctly in the database), and then loads the form data again (correct custom value is in json response), the combo box would then not be populated with this custom value after the loading process.

Why – or how to solve it?

This is the store definition used by the combo box:

// The data store for the diagnoses combobox
var diagnosisStore = Ext.create('Ext.data.Store', {
    fields: ['label', 'value'],
    data: (function() {
        var data = [
            {label: '结膜炎', value: '结膜炎'},
            {label: '角膜炎', value: '角膜炎'},
            {label: '青光眼', value: '青光眼'},
            {label: '白内障', value: '白内障'},
            {label: '葡萄膜炎', value: '葡萄膜炎'},
            {label: '屈光不正', value: '屈光不正'},
            {label: '眼部异物', value: '眼部异物'},
            {label: '翼状胬肉', value: '翼状胬肉'},
            {label: '泪囊炎', value: '泪囊炎'},
            {label: '倒睫', value: '倒睫'},
            {label: '角膜溃疡', value: '角膜溃疡'},
            {label: '角膜白斑', value: '角膜白斑'},
            {label: '眼内炎', value: '眼内炎'}
            ];
        return data;
    })()
});

… and the combo box, note that forceSelection is set to false.

{
    xtype: 'combobox',
    name: 'diagnosis',
    fieldLabel: lang["patient.diagnosis"],
    labelWidth: 60,
    flex:1,
    store: diagnosisStore,
    valueField: 'value',
    displayField: 'label',
    typeAhead: true,
    queryMode: 'local',
    forceSelection: false
}

I also tried to run this line of code, in the listener after the json response has been successfully retrieved:

formPanel.getForm().findField('diagnosis').setValue(rec.data.diagnosis);

but it wouldn’t populate unless the value I am settings is part of the store. So, why is it that a user can type anything into the combo box, but I can’t do the same with setValue in code? Doesn’t make sense to me.

Edit/Update:

The funny thing is: even though the custom value doesn’t populate/isn’t displayed to the user, it seems that the combo box nevertheless holds the custom value. Because when I call this line:

alert( formPanel.getForm().findField('diagnosis').getValue() );

it would actually show the value, which I’ve just tried to set via setValue(), in the alert dialog.
Seems that this combo box component is a bit buggy.

Another issue I just found with this combo box in ExtJs: Also noted that blank values in the combo box don’t get submitted in the form (json parameter in the request), only if I enter one empty space (” “), then the field is actually included in the submitted json parameters.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:03:14+00:00Added an answer on May 25, 2026 at 12:03 am

    I found a workaround, even though I still don’t see why this should be necessary:

    In the success listener, after the json response is loaded, I add the custom value to the store, then set the combo box to this newly added value:

    success: function() {
        diagnosisStore.add({label: rec.data.diagnosis, value: rec.data.diagnosis});
        formPanel.getForm().findField('diagnosis').setValue(rec.data.diagnosis);
    },
    

    No idea why I would need to add the custom value to the store in this case when I want to use setValue, while the user can enter anything manually via keyboard.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridPanel in EXTJS4 with JSONstore. Like this: var storeGridSpe = Ext.create('Ext.data.JsonStore',{
I have a form that contains several comboxes that their data is coming from
We have got an extjs 3.1.1 form with file upload field ( http://www.extjs.com/deploy/dev/examples/form/file-upload.html from
I would like to have a form with which I could filter the data
I'm stumped on this. We have an ExtJS form where birthdate is entered. However,
im trying to add a new user to my database via a form i
I have a window containing a form (formPanel). Users can show this window clicking
I'm using ExtJS on a registration page which should have no effect on this.
When submitting a form with Extjs I can see the form items have values
I have this problem where I need to add a red asterisk beside a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.