You mean to say, there two ways to achieve this functionality ? Because implementation of giving focus to password and user name are different.
Senthilchettyin ( 2013-03-22 05:50:52 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have code as shows below :
<textbox value="@bind(vm.username)" type="text" width="200px" />
<textbox value="@bind(vm.password)" type="text" width="200px" />
<button label="Submit" onClick="@command('save')" />
in mvvm concept, how to setFocus to 'username textbox' after 'save button' clicked ??
thanks a lot,
Hi, you can simply bind a boolean value and use @NotifyChange
<zk>
<window title="new page title" border="normal" apply="org.zkoss.bind.BindComposer" viewmodel="@id('vm') @init('test.FocusVM')">
<textbox type="text" width="200px" focus="@load(vm.userNameFocus)"/>
<button label="Focus User Name" onclick="@command('doFocusUserName')"/>
<textbox width="200px" focus="@load(vm.getFocus('password'))"/>
<button label="Focus Passowrd" onclick="@command('doFocusPassword')"/>
</window>
</zk>
public class FocusVM {
String focus;
boolean isUserNameFocus;
public boolean getFocus(@BindingParam("target") String target) {
return Objects.equals(focus, target);
}
public boolean getUserNameFocus() {
return isUserNameFocus;
}
@Command
@NotifyChange("userNameFocus")
public void doFocusUserName() {
isUserNameFocus = true;
}
@Command
@NotifyChange("getFocus")
public void doFocusPassword() {
focus = "password";
}
}
You mean to say, there two ways to achieve this functionality ? Because implementation of giving focus to password and user name are different.
Senthilchettyin ( 2013-03-22 05:50:52 +0800 )editAsked: 2013-03-21 02:54:16 +0800
Seen: 131 times
Last updated: Mar 22 '13
Is there a way to resolve view model properties as input to client side javascripts?
How to Call Child ViewModel Method from Parent Window? [closed]
ZK MVVM Listbox Mold Paging - select first record on each page [closed]
zul.mesh.wpd this.$n().style is null
Redirect modal window without changing parent window. [closed]