Form Validation client event

asked 2019-11-11 23:39:48 +0800

afxgroup gravatar image afxgroup
126 2

Hello, Is there a way to recover a form validation error on client side? I mean, if i use a validator the @Command is never reached because the validator blocks it. So i need a way to recover the error list i receive in zkau response I didn't find nothing to do this

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2019-11-12 14:46:18 +0800

cor3000 gravatar image cor3000
5868 2 7
ZK Team

There's no dedicated feature for this. You have to send the required data to the client yourself. Either by updating a custom component or by posting javascript directly.

e.g. you can extend the AbstractValidator and then use this as the base class for your validation

public abstract class ClientSideNotifyingValidator extends AbstractValidator {
    protected void addInvalidMessages(ValidationContext ctx, String key, String[] messages, Object value) {
        super.addInvalidMessages(ctx, key, messages, value);
        //Clients.response(new AuInvoke(ctx.getBindContext().getComponent(), "someJsFunctionOnWidget", /*any args*/ key, messages));

It might be I misunderstood your question, in that case it will be easier to respond to an actually running example ideally on http://zkfiddle.org/.

link publish delete flag offensive edit

answered 2019-11-13 17:39:44 +0800

afxgroup gravatar image afxgroup
126 2

Great. Didn't think about sending custom js errors. Thank you

link publish delete flag offensive edit


you're welcome

cor3000 ( 2019-11-19 09:46:58 +0800 )edit
Your answer
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

1 follower



Asked: 2019-11-11 23:39:48 +0800

Seen: 16 times

Last updated: Nov 13 '19

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