jQWidgets Forums
jQuery UI Widgets › Forums › Lists › ComboBox › jqxComboBox type versus select
Tagged: jqxComboBox value input
This topic contains 6 replies, has 4 voices, and was last updated by Peter Stoev 10 years, 3 months ago.
-
Author
-
There is a bug in jqxComboBox behavior where if you typed the value of an existing option from the drop down the selectedItem does not change accordingly. Also, the fact that you can type your value should have better API support. Now, I had to handle it via code (to tell if user typed or selected) which should not be necessary. I thought $(‘#cboCat’).on(‘select, change’, approach would do it but id didn’t.
Hi wnema,
Unfortunately, we don’t think that there’s a bug in that. When you type a value, the selection is changed and the events are raised correctly. The behavior is by design and it should work in that way. Example: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcombobox/events.htm?arctic
Best Regards,
Peter StoevHi Peter,
Whether by design or a bug is debatable, I think. However, regarding the API issue I believe there should be support for $(“#jqxComboBox”).jqxComboBox(‘text’) or $(“#jqxComboBox”).jqxComboBox(‘label’) because when typing in a value $(“#jqxComboBox”).jqxComboBox(‘getSelectedItem’) isn’t defined and thus we cannot do $(“#jqxComboBox”).jqxComboBox(‘getSelectedItem’).label. $(“#jqxComboBox”).val() correctly gives you what you typed but when selecting from a drop down gives the “value” equivalent of <option value=”1″>one</option>. In other words, how can you in one call always get the text of either what you typed or selected from a list?Hi wnema,
Each combobox item has “label” and “value”. “getSelectedItem” returns an Item which have Label and Value in jQWidgets 3.6.0 – the current version. Online Demo: http://jsfiddle.net/76mpd81c/
Best Regards,
Peter StoevHi,
I was agree with wnema, that will be appreciate to have a direct access to the input control by a function like getinputvalue. Normally a comboBox was a input text with a list of choice for it, now is look more a DropDownList with a search. Just adding a function will be more them welcome.
This was my work arround :
Controle name :
$(“#textcombo”).jqxComboBoxInput access :
var input_combo =$(“#textcombo input”);
//console.log(input_combo);
var txt_combo =input_combo[0].value;Regards
I also agree with wnema. I need to get what the person types if it is not a selected item.
There is val() method which you can use for getting the widget’s value or what’s typed in if there’s no value. – http://jsfiddle.net/jqwidgets/Laykzxvj/. The getSelectedItem should return the selected item and we don’t agree that is shouldn’t return it!
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.