Make popup display after notifyChange complete..

asked 2014-07-17 04:59:24 +0800

JustinFrost gravatar image JustinFrost
139 1 6

Hi all,

Is there a way to make code in the controller class execute after the notifyChange has occured in the viewModel command ?

I have the following zul:

<div id="divLogin" apply="org.zkoss.bind.BindComposer,com.foo.LoginController" viewModel="@id('vm') @init('com.foo.LoginView')">
<jmessagebox text="@bind(vm.loginErrorMessage)" style="width:31rem;margin-top:1.5rem;"/>
<label>Username or email</label>
<textbox id="tbUser" onOK="@command('doLogin')" value="@bind(vm.userName)" tabindex="1"/>
<textbox id="pbPassword" ignoreKeys="32" onOK="@command('doLogin')" value="@bind(vm.password)" tabindex="2"/>
<popup id="tip" style="width:27rem;">${vm.tip}</tip>
<utton label="Login" id="btnLogin" onClick="@command('doLogin')" tabindex="3"/>

in my viewModel the validation sets an errorMessage and a flag in doLogin indicating that the controller needs to open the popup.

public void doLogin() {
    if (getInvalidAuthorisationAttemps() == 2){


@Listen("onClick=#btnLogin; onOK=#tbUser; onOK=#pbPassword")
public void doLogin() {
    if (getLoginView().isShowUnmaskPasswordTip())
        tipUnmaskPassword.open(pbPassword, "end_center");

The issue is that the errorMessage is being updated via notiyChange AFTER the popup is open in the controller. The popup therefore is displayed and then the field is pushed down when the error message displays leaving the popup in the wrong location.

Any clues for resolving this one ?


delete flag offensive retag edit


It is strongly not recommended to mix MVC and MVVM pattern this way.

vincentjian ( 2014-07-29 03:14:57 +0800 )edit

Thanks for the reply. Is there another way of doing this - it is not recomended to modify components in the viewModel, but there is no otherway of changing the tooltip position that I am aware of..

JustinFrost ( 2014-08-20 09:43:53 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-02 11:04:44 +0800

vincentjian gravatar image vincentjian
2245 6

updated 2014-10-02 11:06:29 +0800

Hi, please try this

ZUL Page

<div apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('com.foo.LoginView')">
    <textbox id="pbPassword" ignoreKeys="32"
        onOK="@command('doLogin')" value="@bind(vm.password)" />
    <popup id="tip">${vm.tip}</tip>

In ViewModel

public void doLogin(@SelectorParam("#tip") Popup tip,
        @SelectorParam("#pbPassword") Textbox pbPassword) {
    if (getInvalidAuthorisationAttemps() == 2){
        tip.open(pbPassword, "end_after");

Refer to the document about how to use @SelectorParam

link publish delete flag offensive 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: 2014-07-17 04:59:24 +0800

Seen: 24 times

Last updated: Oct 02 '14

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