-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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
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 {
@Override
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));
//or
Clients.evalJavaScript("someArbitraryJS(...);");
}
}
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/.
Asked: 2019-11-11 23:39:48 +0800
Seen: 16 times
Last updated: Nov 13 '19
Verify existence -Verificar existencia DNI
Selectbox - constraint="no empty" not working
MVVM form validation for field inside template
Custom Validator: sometimes works, sometimes doesn't
How to stop combining commands in an ajax call ?
zk.auSend not called on composer
Font Awesome Problem with IE8 when security option "font download" is disabled