-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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>
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...
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
Asked: 2009-03-18 17:11:48 +0800
Seen: 191 times
Last updated: Mar 30 '09