0

WrongValuesException and focus strange behaviour

asked 2009-03-18 17:11:48 +0800

madruga0315 gravatar image madruga0315 flag of Brazil
937 2 12

updated 2009-03-18 17:13:20 +0800

Hi,

I'm using the WrongValuesException feature added in version 3.6, and before calling this method, I set the focus on the first component which has error. Then the error message behaves strange...

Here is a sample code to run in zk demo, click in the save button once, and the errors appear correclty, then click the save button again, without touching in the keyboard, then the error in the first textbox don't appear, just in the second textbox.

If I don't set the focus on the textbox1, then it works fine.

<window title="My First Window" border="normal" width="200px">
    <textbox id="txb1"/>
    <textbox id="txb2"/>
    <button label="save" onClick="save()"/>
    <zscript>
        public void save() {
            ArrayList al = new ArrayList();
            if(txb1.getValue() == null || txb1.getValue().isEmpty()) {
                 al.add(new WrongValueException(txb1, "fill textbox 1"));
                 txb1.focus();
            }
            if(txb2.getValue() == null || txb2.getValue().isEmpty())
                 al.add(new WrongValueException(txb2, "fill textbox 2"));
            if(al.size() > 0)
                throw new WrongValuesException(al.toArray(new WrongValueException[1]));
        }
    </zscript>
</window>

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2009-03-18 18:07:03 +0800

YamilBracho gravatar image YamilBracho
1722 2

It seems the problem is which component has the focus.
If you comment the line "txb1.focus();" the code works as expected but if you put the cursor
in a textbox it only shown the validation for the control does not has the focus...

link publish delete flag offensive edit

answered 2009-03-23 19:15:59 +0800

madruga0315 gravatar image madruga0315 flag of Brazil
937 2 12

Hi again,

Also, in the first case, when both error messages appear, if user just select the textbox, without typing, and change the focus, the error message disappear.

In my point of view, this is not right, the error message should disappear only when user types something, and not with focus and changing focus.

Is this a bug?

Thanks,
Regards,
Madruga

link publish delete flag offensive edit

answered 2009-03-30 05:28:52 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

Post to ZK Bug. Let's discuss this there.

link publish delete flag offensive edit

answered 2009-03-30 12:48:30 +0800

madruga0315 gravatar image madruga0315 flag of Brazil
937 2 12

Done. Here it is.

Regards,
Madruga

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: 2009-03-18 17:11:48 +0800

Seen: 191 times

Last updated: Mar 30 '09

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