-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579042
By: nobody
I am design a web app, which having list input, generally like username, password, comfirmpassword, email, i just wonder, can i call a method when email textbox be focused, i tried few ways, it is not work. however i found the online demo, there called a show method to do something. can anyone give me some sample
<textbox action="focus: action.show(help1); blur: action.hide(help1)"/> <label id="help1" visible="false" value="This is help for text1."/>
above code from online demo.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579063
By: tomyeh
The action attribute is so-called Client Side Action (CSA). Ie, it executes at the client (as JavaScript). Refer to the User Guide.
If all you need to response can be done at the client (onfocus is usualy the case), CSA is what you need.
There is no convenient way to handle onfocus at the server side (via Java), because we don't send the onFocus event back to the server, due to round-trip consideration. You could post this to feature request, and we will listen to other users' opinions.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579100
By: nobody
hi, i c. what you mean, i write down zscript on the page, however, it seems doesn't call the right method when focus on
<window title="Client side action" border="normal"
xmlns:h="http://www.w3.org/1999/xhtml">
<grid>
<rows>
<row>
<label value="email: "/>
<textbox id ="email"/>
</row>
<row>
<label value="Confirm email"/>
<textbox id ="conemail"/>
</row>
<row>
<label value="name: "/>
<textbox action="focus: action.docheck(); blur: action.hide(check)"/> <label id="check" visible="false" value="email and Confirm email are not match"/>
</row>
</rows>
</grid>
<zscript>
void docheck(){
if (email.value() == conemail.value()) { check.visible ="false"; }else{ check.visible = "true"; } } </zscript> </window>
that is my sample code
could you any idea, why is that ?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579119
By: tomyeh
The codes specified in CSA is JavaScript and evaluated by the browser. In the sample codes, action.show(help1) is JavaScript, not java codes.
On the other hand, the codes specified in the onClick, onChange... attributes are Java codes that will be evaluated at the server side.
To trigger the Java codes specified in the onClick attribute, ZK Client Engine has to send a request back (i.e., Ajax request) back to the server.
Thus, in the codes you posted, there must be some JavaScript called action.docheck().
However, it is nothing to do with the docheck function defined in zscript.
In current spec, ZK doesn't send onFocus event back to server, so there is no onFocus attribute to let you process the event at the server.
You might read the Basics chapter in the User Guide again to get a bird view about ZK.
Remember CSA is designed for people who really depend on JavaScript. For most of developers, it is usually unnecessary.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579572
By: nobody
i c, thank you so much explain all those thing, i was tried serveral times.
thank you. now i will write some jscript for it. ha .great shuff
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579638
By: tomyeh
You are welcome :)
Asked: 2006-02-16 02:51:11 +0800
Seen: 893 times
Last updated: Feb 16 '06