Combobox custom label and value

asked 2013-02-04 06:49:12 +0800

zeroho gravatar image zeroho
16 2

updated 2013-02-04 08:19:31 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8

Hi All,

I have a Table A having the following schema: a-id, a-name

public class A{
int id; //get&set methods
String name; //get&set methods

and Table B having the following schema: b-id, a-id {a-id is a foreign-key referring Table A}

public class B{
int id; //get&set methods(Foreign Key)
int idB; //get&set methods


I have a SQL statement that create a Model List for being used on the webpage:

select * from A left join B on A.a-id = B.a-id;
  • which generates a-id, name, b-id

(aka C)

I created a grid using model as what (C) looks like. And there are 2 columns in the Grid namely:

B-ID,   Name ( aka D)

I would like to create a combobox for column (D) to update a record in Table B; the combobox should looks like:

Label of a-name but use the value with <a-id>

May I ask how to achieve it; is there any relevant small talks / previous thread that I can refer to?

Thanks a lot.

delete flag offensive retag edit


Didn't get your question very clearly, is it relates to UI or just your domain logic? maybe you should provide a simple one that relate to UI. and you can do the domain logic in the controller

dennis ( 2013-02-08 03:43:01 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-05 08:32:08 +0800

benbai gravatar image benbai
2228 6

Yes, you can set both label and value to a comboitem and then you can use Combobox.getSelectedItem().getValue() to replace Combobox.getValue()


    <combobox id="cbx">
        <comboitem label="label one" value="value one" />
        <comboitem label="label two" value="value two" />
    <button label="test">
        <attribute name="onClick"><![CDATA[
            if (cbx.getSelectedItem() != null) {
            } else {
link publish delete flag offensive 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

1 follower



Asked: 2013-02-04 06:49:12 +0800

Seen: 151 times

Last updated: Mar 05 '13

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