-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
I have a small workaround for this problem.
If you use a validator you can doe this :
private final Validator emptyCKEditorValidator = new AbstractValidator() {
@Override
public void validate(ValidationContext ctx) {
String val = (String) ctx.getProperty().getValue();
if (val == null || "".equals(val.trim())) {
Clients.wrongValue(ctx.getBindContext().getComponent(), Messages.get(MZul.EMPTY_NOT_ALLOWED));
addInvalidMessage(ctx, "");
}
}
};
Zul :
<ckeditor customConfigurationsPath="/js/ckeditor-config.js" value="@bind(fx.description) @validator(vm.emptyCKEditorValidator)" height="250px" />
This will trigger when fx will be saved.
Small explication :
The Clients.wrongValue(Component,String)
will set the popup for the CKEditor.
The Messages.get(MZul.EMPTY_NOT_ALLOWED)
will get the I18N from zul-x.x.x.x.jar.
If you use the MZul class, it's a little more readable then if you use the code directly from the msgzul.properties file.
So, this means that I have I18N activated for this and have the same message as constraint="no empty"
.
I still do the addInvalidMessage(ctx,"")
because otherwise it will trigger the save command.
Greetz chill.
2 | No.2 Revision |
I have a small workaround for this problem.
If you use a validator you can doe do this :
private final Validator emptyCKEditorValidator = new AbstractValidator() {
@Override
public void validate(ValidationContext ctx) {
String val = (String) ctx.getProperty().getValue();
if (val == null || "".equals(val.trim())) {
Clients.wrongValue(ctx.getBindContext().getComponent(), Messages.get(MZul.EMPTY_NOT_ALLOWED));
addInvalidMessage(ctx, "");
}
}
};
Zul :
<ckeditor customConfigurationsPath="/js/ckeditor-config.js" value="@bind(fx.description) @validator(vm.emptyCKEditorValidator)" height="250px" />
This will trigger when fx will be saved.
Small explication :
The Clients.wrongValue(Component,String)
will set the popup for the CKEditor.
The Messages.get(MZul.EMPTY_NOT_ALLOWED)
will get the I18N from zul-x.x.x.x.jar.
If you use the MZul class, it's a little more readable then if you use the code directly from the msgzul.properties file.
So, this means that I have I18N activated for this and have the same message as constraint="no empty"
.
I still do the addInvalidMessage(ctx,"")
because otherwise it will trigger the save command.
Greetz chill.