0

How to get 'value' of Selected ComboItem

asked 2014-09-24 11:39:07 +0800

Amol987 gravatar image Amol987
15 3

updated 2014-09-26 10:27:41 +0800

chillworld gravatar image chillworld flag of Belgium
5357 4 9
https://github.com/chillw...

Hi, Please find my demo on below link

http://zkfiddle.org/sample/118m6n0/7-ZK-combobox-tester

so, i am not able to get the 'value' of the selected comboitem. rather i am getting 'label' of selected of item

Example. if i select label 'Cool' i want value as '3'.

I want value only in javascript , not in java side

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-09-25 13:12:56 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Please use below code

<?page title="Tester" contentType="text/html;charset=UTF-8"?>
<zk xmlns:w="http://www.zkoss.org/2005/zk/client">
<script type="text/javascript">
function buttonClick(){
    var comboboxValue = zk.Widget.$(jq('$combo')[0]).getValue();

    alert("value of selected label " +comboboxValue );  

}
</script>
<window id ="asd"  >
<combobox id="combo">
    <comboitem label="Simple and Rich" value="1"/>
    <comboitem label="Cool!" value="3"/>
    <comboitem label="Ajax and RIA" value="2"/>
    <comboitem label="RIA" value="s2"/>
</combobox>
<button id="clear" label="clear" w:onClick="buttonClick();"/>
</window >
</zk>
link publish delete flag offensive edit

Comments

@sjoshi : given solution is not satisfying my requirement . i want the value of selected comboitem , not the label.

Amol987 ( 2014-09-26 06:42:06 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-09-24 11:39:07 +0800

Seen: 69 times

Last updated: Sep 26 '14

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