CKEditor constraint property

asked 2015-08-26 07:46:08 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9

Hi all,

I just created the next feature request : http://tracker.zkoss.org/browse/ZKCK-22

I created this discussion in order to see who want's this to.

Greetz chill.

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2015-08-26 11:25:53 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9

updated 2015-08-26 11:26:05 +0800

I have a small workaround for this problem.

If you use a validator you can do this :


private final Validator emptyCKEditorValidator = new AbstractValidator() {

    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.

link publish delete flag offensive edit
Your reply
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: 2015-08-26 07:46:08 +0800

Seen: 25 times

Last updated: Aug 26 '15

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