0

Communication between client events and server events

asked 2012-05-15 10:35:32 +0800

Neus gravatar image Neus
1415 14
Hi, I want to listen to an HTML button onClick event in server side. This is my actual code:
<div id="pantallalogin" apply="org.sts.Login.LoginNuevo">
<n:div id="registration">
	<n:div id="tituloEmpresa">
	 <image id="imagenEmpresa" sclass="imagenEmpresa" src="../../img/Comunes/logoPequenyoSTS.PNG"/><label id="nombreEmpresa" sclass="nombreEmpresa">_Nombre empresa</label>
	</n:div>
	 	<n:fieldset>
	         <n:p>
	            <n:label for="name">Nombre</n:label>
	            <n:input id="name" name="name" type="text" class="text"/>
	         </n:p>
	         <n:p>
	            <n:label for="password">Password</n:label>
	            <n:input id="password" name="password" class="text" type="password" />
	         </n:p>
	        <n:p>
	        	 <n:label for="ambiente">Ambiente...</n:label>
	            <n:select id="ambiente" class="text" >
	            </n:select>
	         </n:p>
	         <n:p>
	            <n:label for="acceptTerms">
	                Realizado por <n:a href="http://www.sts-systems.com/">Soft Team Systems S.L.</n:a>
	            </n:label>
	         </n:p>
	        
	         <n:p>
	            <n:button id="registerNew" onclick="logarUsuario()">
		            <script type="text/javascript"><![CDATA[
					function logarUsuario(){
							alert("Logar usuario");
							zAu.send(new zk.Event(jq("$pantallalogin"), 'onLogin', 'Parameter'));
						}
					]]></script>
				Login</n:button>
	         </n:p>
	 	</n:fieldset>
	
</n:div>
</div>
public void onLogin$pantallalogin(ForwardEvent fe){
		alert("Evento onLogar!");
	}
The alert in onLogin$pantallalogin(ForwardEvent fe) never shows. Is the first time I'm using this so I'm sure I'm doing something wrong. Can anyone tell me why this doesn't works? Thank you!
delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-05-15 13:54:41 +0800

Neus gravatar image Neus
1415 14

I tried this too

<n:button id="registerNew" onclick="logarUsuario()">Login</n:button>
	<script type="text/javascript"><![CDATA[
					function logarUsuario(){
							alert("Logar usuario");
							alert(zk.Widget.$("$pantallalogin"));
							wgt=zk.Widget.$("$pantallalogin");
							zAu.send(new zk.Event(wgt, 'onUser', null));
						}
					]]></script>

And it is giving me this exception:

15-may-2012 15:51:29 org.zkoss.zk.ui.impl.UiEngineImpl handleError:1351
GRAVE: >>java.lang.IllegalArgumentException: argument type mismatch
>>	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>	at java.lang.reflect.Method.invoke(Unknown Source)
>>	at org.zkoss.zk.ui.event.GenericEventListener.onEvent(GenericEventListener.java:96)
>>	at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2736)
>>	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2707)
>>	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2648)
>>	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
>>	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:534)
>>	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.run(EventProcessingThreadImpl.java:461)

link publish delete flag offensive edit

answered 2012-05-15 13:56:35 +0800

Neus gravatar image Neus
1415 14

I found it.
The second code I posted is OK. But in java code I was declaring public void onUser() instead of public void onUser$pantallalogin()

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-05-15 10:35:32 +0800

Seen: 224 times

Last updated: May 15 '12

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