0

Validator. Retrieve command arguments

asked 2014-08-01 17:13:46 +0800

stream gravatar image stream
81 3

I need to retrieve command arguments from Validator that is executed before the command (command='doSave', Validator=vm.validator) But I cannot do that. Only validator arguments are available.

zul:

form="@id('fx') @load(vm.form) @save(vm.form, before={'doSave','doSaveAndExit'}) @validator(vm.validator)"
...

View Model:

Map<String, Object> params = new HashMap<String, Object>();
params.put("param", "test value");
binder.sendCommand("doSave", params);
...

View Model:

public Validator getValidator() {
    return new AbstractValidator() {
        @Override
        public void validate(ValidationContext ctx) {
            ...
            BindContextImpl bc = (BindContextImpl) ctx.getBindContext();
            Map<String, Object> args = bc.getCommandArgs();
            ...
        }
    };
}

After some debugging I found that it is not possible to do because Bind context (BinderImpl.java, lines 1483,1484) that contained command arguments is "lost" and there is another BindContext created instead of it that contains only validator arguments (ValidationHelper.java, lines 262,263).

Can this functionality be added in the future release?


Thanks, Eugene

delete flag offensive retag edit

Comments

why you cannot pass parameters you want into the validator directly?

hawk ( 2014-09-26 02:14:21 +0800 )edit
Be the first one to answer this question!
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

Follow
1 follower

RSS

Stats

Asked: 2014-08-01 17:13:46 +0800

Seen: 20 times

Last updated: Aug 01 '14

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