|
Title: Problem with combobox getValue Post by: galcott on February 03, 2023, 08:36:17 AM I am using a combobox populated from a database using this code. So when I use the 'getValue' method I assume I should get the valueField, not the textField. But I am getting the textField and can't seem to find any way to get the valueField.
Code: <INPUT class='easyui-combobox' ID='selMaterial' editable=false label='Material' labelWidth=80 style='width: 350px' (https://galcott.com/comfitdemo/easyui1.jpg) And this shows the result of 'getValue' which is actually the same as 'getText'). Why is 'getValue' returning the valueField? (https://galcott.com/comfitdemo/easyui2.jpg) Title: Re: Problem with combobox getValue Post by: jarry on February 04, 2023, 07:29:41 PM Please make sure the data format returned from your server should be:
Code: [ Title: Re: Problem with combobox getValue Post by: galcott on February 08, 2023, 12:27:53 PM Yes, that is data format from the server. Here it is.
Code: [ { "code": "", "name": ""},{ "code": "A1", "name": "A1 - COMFORTLITE EVA"},{ "code": "A3", "name": "A3 - SOFTFIT - EVA"},I found that this problem actually occurs in two of the three functions where I use this combobox. In the other one the 'getValue' works correctly. Here is a screen shot showing the result when it works correctly, which as you can see is different from the previous screen shot. (http://galcott.com/comfitdemo/easyui3.jpg) Can you tell me any possible reason why this would happen? I've tested this a lot and can't figure it out. Title: Re: Problem with combobox getValue Post by: jarry on February 08, 2023, 06:49:29 PM If the text on the combobox is modified manually, it may not find any data item that matches the inputing text and then this inputing text is accepted as the value.
Please try to set the 'limitToList' property to true to let the combobox only accept the data list item. Title: Re: Problem with combobox getValue Post by: galcott on February 08, 2023, 09:44:32 PM The text is not being modified manually. I'm simply selecting it by clicking on the list, and limitToList is set to true.
I really can't figure out what's happening here. It's actually happening on two different comboboxes, but I have others, also populated from a database, where it works correctly. Do you have any other ideas? |