0

Selectbox - constraint="no empty" not working

asked 2016-04-13 08:06:15 +0800

Ricko gravatar image Ricko
1

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.

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2016-04-14 06:03:50 +0800

Darksu gravatar image Darksu
1991 1 4

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

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
1 follower

RSS

Stats

Asked: 2016-04-13 08:06:15 +0800

Seen: 31 times

Last updated: Apr 14 '16

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