-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Want to set no empty for Selectbox
Hi, I am new to ZK. After spending some time with ZK MVVM and Spring I really like it. Now I am planning to develop a small online job application System using ZK 8 MVVM and Spring.
I have an application form with many textboxes and selectboxes. For required textboxes I can easily set
constraint="no empty"
But for selectboxes I have no option. I have created one FormValidator. I want to have same user experience during validation for all input elements in my form.
Hello Ricko,
Please use the following script as a reference:
<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<zscript><![CDATA[
java.util.ArrayList list = new java.util.ArrayList();
list.add("");
list.add("option 1");
list.add("option 2");
list.add("option 3");
org.zkoss.zul.ListModelList model = new org.zkoss.zul.ListModelList(list);
]]></zscript>
<selectbox model="${model}" xmlns:w="client">
<attribute w:name="doBlur_"><![CDATA[
function(evt) {
this.$doBlur_(evt);
if (this.$n().value == '') {
zAu.wrongValue_(this, 'Please select.....');
} else {
zAu.cmd0.clearWrongValue(this.uuid);
}
}
]]></attribute>
</selectbox>
</zk>
Best Regards,
Darksu
Asked: 2016-04-13 08:06:15 +0800
Seen: 32 times
Last updated: Apr 14 '16
MVVM, How to display @validator error like the constraint attribut error ?
Custom Validator: sometimes works, sometimes doesn't
How to Disable Mandatory Constraint for email textbox
Validate datebox invalid input with validators
How to restrict button click when textbox input violates the constraint
Notify Form of property change
How to handle lists and complex types with form?
How to check dirty in listbox, if my listcell value has changed ?