0

how to fire javascript on view-model end ?

asked 2012-12-18 08:08:05 +0800

unitcell gravatar image unitcell
28 4

updated 2012-12-18 08:59:45 +0800

Hi all,

Referent ZK Demo effect login .

<zscript><![CDATA[
		void loginCheck () {
			if ((name.getValue().equals("zk") && pwd.getValue().equals("zk"))) {
				mesg.setValue("OK");
				Clients.evalJavaScript("zk.Widget.$('$loginWin').setMinimized(true)");
				initBtn.getParent().appendChild(new Label("Login Success !! Welcome to ZK Demo!"));
			} else {
				mesg.setValue("User Name or Password Invalid!");
				Clients.evalJavaScript("loginFaild()");
			}; 
		}
		]]></zscript>


I wanna change loginCheck() on view to view-model end.

if loginCheck() on view-model return fail(false), how do I got something from view-model to fire this code :

Clients.evalJavaScript("loginFaild()") on view end ?

Thanx.

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2012-12-18 11:13:31 +0800

afxgroup gravatar image afxgroup
126 1

you could add a div displayed only when a variable is bind to. For example on viewmodel you could have an Integer that is 0 for no action, 1 for login ok and 2 for login error. Then you could bind it to a div on zul side and then change it in your loginCheck() when it is called

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

Follow

RSS

Stats

Asked: 2012-12-18 08:08:05 +0800

Seen: 62 times

Last updated: Dec 18 '12

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