0

Combobox default selection

asked 2006-03-06 14:11:53 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3613108

By: jim_bo_lisa

Is there a way to set a default selected item in a Combobox? I do not see any methods in the API for Combobox that would do this.

Want to have one of the Comboboxitems visible by default instead of the blank.

thanks

delete flag offensive retag edit

12 Replies

Sort by ยป oldest newest

answered 2006-03-06 14:16:20 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3613115

By: tomyeh

ZK combobox doesn't work this way. It is a special input with a set of pre-defined values that user could select from. In other words, it does keep any state about what is selected. It simply copies the content to the input field.

In your case, you have to maintain it by application such as checking which is the most matched and restoring the last matched one(a bit tedious).

link publish delete flag offensive edit

answered 2006-03-06 14:23:25 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3613129

By: matteo_barbieri

Hi, you could use the text attribute:

<combobox id="combo" text="Default">
<comboitem label="Simple and Rich"/>
<comboitem label="Cool!"/>
<comboitem label="Thumbs Up!"/>
</combobox>

Or

<zscript>
combo.setText("Default");
</zscript>


Bye

link publish delete flag offensive edit

answered 2006-03-06 14:27:09 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3613141

By: jim_bo_lisa

Good timing. I was just trying this by dynamically creating the Combobox from java.

Combobox comboBox = new Combobox();
comboBox.appendItem("and");
comboBox.appendItem("or");
comboBox.setWidth("40px");
comboBox.setText("default text here");

I am getting a javac compile error on the setText method call. I am not sure why. Any ideas?

[javac] C:\devel\workspace\src\java\condenserii\webtier\zkextensions\QueryBu
ilderRow.java:33: cannot access com.potix.lang.SystemException
[javac] file com\potix\lang\SystemException.class not found
[javac] comboBox.setText("default text here");
[javac] ^
[javac] 1 error

link publish delete flag offensive edit

answered 2006-03-06 14:31:16 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3613147

By: matteo_barbieri

It seems that not all ZK jar files are in your classpath.
Verify that the file called pxcommon.jar is in your classpath.

link publish delete flag offensive edit

answered 2006-03-06 14:42:57 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3613164

By: jim_bo_lisa

Thanks. It was in my Eclipse classpath but not my Ant build file. All works now.

FYI, project management here is loving what ZK brings to the table.

link publish delete flag offensive edit

answered 2006-03-28 08:08:20 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3654580

By: nobody

Hi,

I'm trying to use ZK component to capture user input. When using combobox with autodrop=true, after entering some characters and press tab, the behaviour for IE and FF is different. On FF, focus changed to the dropdown list. For IE, dropdown list closed and focus changed but not to next field. (It jump to 3rd field. Not sure whether this is related to dropdown list's length). Attached ZUL show the issue.

Also, I would like to know whether these functions can be added to combobox

1) constriant which check the input must be in the list. (I like to use combobox instead of listbox if the list is long and the input is short, for example, enter country code).
2) autocomplete the entry if one item is uniquely identified in the dropdown list by pressing tab to exit.

Regards,
Michael

<window id="addTask" border="0">
<vbox>
<html>
<attribute name="content"><![CDATA[
<h4>Add New Task </h4>
<p>Enter Required Information and then press "Save" to create new task.</p>
]]></attribute>
</html>
<hbox spacing="20">
<grid>
<columns>
<column width="200px"/>
<column width="350px"/>
</columns>
<rows>
<row>
<label value="Project ID.:" />
<combobox id="proj" width="350px" constraint="no empty" autodrop="true">
<comboitem label="FMS" description="SAP Finance" />
<comboitem label="HRMS" description="SAP Human Resources" />
<comboitem label="IMS" description="Spare Part Inventory Maintenance System"
/>
<comboitem label="PAY" description="Daily Rated Payroll" />
</combobox>
</row>
<row>
<label value="Task Type:" style="font-size: 10px" />
<listbox id="type" mold="select" rows="1" width="100px" >
<listitem label="SCR" value="S" />
<listitem label="HEAT Call" value="H" />
<listitem label="Others" value="O" />
<listitem label="Evaluation" value="E" />
</listbox>
<zscript>
type.setSelectedIndex(0);
</zscript>
</row>
<row>
<label value="Reference ID.:" style="font-size: 10px" />
<textbox id="refID" constraint="no empty" />
</row>
<row>
<label value="Description:" />
<textbox id="desc" constraint="no empty" maxlength="15"/>
</row>
<row>
<label value="Dept. Code:" />
<listbox id="deptCode" width="350px" rows="3" >
<listitem label="ACC">
<listcell><label value="Accounts Dept." /></listcell>
</listitem>
<listitem label="ITY">
<listcell><label value="Information Technology" /></listcell>
</listitem>
<listitem label="FPC">
<listcell><label value="Financial Planning & Costing" /></listcell>
</listitem>
<listitem label="TRA">
<listcell><label value="Traffic Dept." /></listcell>
</listitem>
<listitem label="HMR">
<listcell><label value="Human Resources" /></listcell>
</listitem>
</listbox>
</row>
<row>
<label value="Submitted By:" />
<textbox id="submitBy" constraint="no empty" />
</row>
<row>
<label value="Complexity:" />
<radiogroup width="250px" id="complexity">
<radio label="Low" value="L" />
<radio label="High" value="H" />
<radio label="Medium" value="M" />
</radiogroup>
</row>
<row>
<label value="Request Completion:" />
<datebox constraint="no empty, no future" id="reqCompletionDate"
format="dd-MM-yyyy" />
</row>
<row>
<label value="Completion:" />
<datebox constraint="no future" format="dd-MM-yyyy" id="completionDate" />
</row>
</rows>
</grid>
</hbox>
</vbox>
<separator />
</window>


link publish delete flag offensive edit

answered 2006-03-28 14:46:10 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3655228

By: tomyeh

>> For IE, dropdown list closed and focus changed but not to next field.

Post to Bugs. Thanks.

>> constriant which check the input must be in the list.

To popup an error box is simple:
public void onChange() {
...
throw new WrongValueException(this, "Something Wrong");

I'll consider whether to add this special constraint to SimpleContraint.

>> autocomplete the entry...
This can be done by listening onChange.

Again, whether to add a special feature, I have to consider kinds of implementations.
We use to sum up possible application and then provide a 'minimal' solution to cover most of them.


link publish delete flag offensive edit

answered 2007-11-02 08:33:31 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4601586

By: heidiatwork

Hi,

my problem is:

There's a combobox, showing different dates (read from database) and depending on this date, additional information should be shown ( in a listbox..)

What I want to do:

read dates from database, provide combobox with these dates (down with foreach..), "autoselect" the first date and then show addional information according to that date...

First question: how do I the autoselect and call immediately any method...
Second Question: for the first time (in case of autoselecting the date), how can I hide the addional information ..???

regards,
heidi

link publish delete flag offensive edit

answered 2007-11-03 14:51:22 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4603411

By: oberinspector

to select the first item you can write in java:
((Comboitem)combobox.getFirstChild()).setSelected(true);

link publish delete flag offensive edit

answered 2007-11-04 13:50:03 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4604373

By: garok

Comboitem does not have setSelected method

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2006-03-06 14:11:53 +0800

Seen: 1,568 times

Last updated: Nov 06 '07

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