3

combobox can't distinguish items with same label [closed]

asked 2013-03-16 13:07:10 +0800

nsharma gravatar image nsharma flag of India
917 1 11

I'm using a list in combobox which containd same label but its value is different,but the problems is that it is treating each those comboitems as same which has same label value. So on change event doesn't get fired up if you select one item with label as "low" and try to select another item with same label.

here is my demo code:-

<combobox width="58px" id="combo" onChange="@command('click')"

autodrop="true"

readonly="true">


<comboitem value="1" label="D" />

<comboitem value="2" label="Low" />

<comboitem value="3" label="Low" />

<comboitem value="4" label="Low" />

<comboitem value="5" label="Mr" />

<comboitem value="6" label="Ms." />

<comboitem value="7" label="Lor" />

</combobox>

I am using the value assinged to each comboitem in my VM ,but it is taking only one value for every item with same label,i think the value of first item with same label. help me out guys.

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by nsharma
close date 2013-03-25 07:10:41

3 Answers

Sort by ยป oldest newest most voted
4

answered 2013-03-19 10:13:24 +0800

hswain gravatar image hswain flag of India
1763 3 10
http://corejavaexample.bl...

@nsharma you can use onselect event instead of onchange event

link publish delete flag offensive edit

Comments

This solved my issue.I think on change check whether there is a change in label or not.

nsharma ( 2013-03-19 10:21:10 +0800 )edit
1

answered 2013-03-17 14:11:30 +0800

Jales gravatar image Jales
161 1

updated 2013-03-17 14:14:29 +0800

Why not use Listbox with mold = select? According to the ZK Component Reference : A combobox is a special text box that embeds a drop-down list. With comboboxes, users are allowed to select from a drop-down list, in addition to entering the text manually.

This means, anything that you selected from the drop-down list will be assigned to the textbox of the combobox from the label of the comboitem, not from the value.

If you want to use the value (not the label), use the listbox item. Or, use different label for each comboitem.

link publish delete flag offensive edit

Comments

I think good explanation

sjoshi ( 2013-03-17 16:46:37 +0800 )edit
1

actaully in my case i have to use both label and value.

nsharma ( 2013-03-18 09:02:52 +0800 )edit

This is a dynamic list ,so label can be same,depends upon the input.

nsharma ( 2013-03-18 09:03:29 +0800 )edit
1

answered 2013-03-21 12:32:36 +0800

hswain gravatar image hswain flag of India
1763 3 10
http://corejavaexample.bl...

@nsharma actually onselect idea not good you can find different idea to solve this issue

link publish delete flag offensive edit

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-03-16 13:07:10 +0800

Seen: 92 times

Last updated: Mar 21 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More