-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Dear All
I hope all are OK.
I am new to ZK and I want to implement a field validation such that if the value entered in the filed is not valid, an error message should be displayed and the focus is not transferred to the next field e.g. the focus remains on the filed with incorrect value, and what is the best approach to use, constraints
or onChanged
event. In case if the constraints is advised, how to implement and call custom constraints implemented in a Java class.
I have also another issue , I want to implement an edit mask such that the value entered by a user is formatted before the user leaves the field e.g. if the user is submitting an amount,the entered amount should look like this 123,456.789 even if the filed has the focus and the user did not leave the field.
For your information, I have a legacy PowerBuilder financial application which I am trying to migrate to java. The above mentioned issues were easy to implement in PowerBuilder and I am trying to have the same behavior using ZK.
Best regards;
Hello AAdel,
In order to implement a custom constraint please refer to the following url:
http://books.zkoss.org/wiki/ZKComponentReference/BaseComponents/InputElement#CustomConstraint
Regarding the second question you can find some good examples at the following url:
http://www.zkoss.org/zkdemo/effects/form_effect
Best Regards,
Darksu
Hi AAdel,
Personally I don't like that you can't change the focus until you have the correct value set.
It's easier/better to show the notifications when you press the submit
button and the submit button will do nothing.
In this topic you can see how to put regex and internationalisation as constraint.
You can trow also the constraint from java side with a WrongValueException
.
Second question : Maybe you could have a look at this.
Greetz chill.
Check here
Asked: 2014-09-28 09:09:47 +0800
Seen: 18 times
Last updated: Sep 30 '14