-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3664260
By: oberinspector
i want to redraw a window, afterr the login status has changed. I read i must not use redraw...
void logout() {
ctt_login.logout(session);
LoginWindow.invalidate(LoginWindow.INNER);
}
i tried this with inner and outer, but nothing happend...
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665108
By: tomyeh
First, using invalidate is correct to redraw a window. To redraw a page, use page.invalidate(). INNER means only the inner part needs to be updated.
Is logout() called by an event listener?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665237
By: oberinspector
yes... when a user is already logged in and stored in the session no login form should appear... i have a logout button, onClick calls logout:
<window id = "LoginWindow" title="Login" border="normal" width="300px"
onOk="submit()">
<zscript>
ctt_login = new de.infratour.constraints.Login();
noSessionUser = (Boolean)!ctt_login.hasSessionUser(session);
if(!noSessionUser){
LoginWindow.title=ctt_login.getSessionUserNickname(session);
}
void submit() {
ctt_login.validateLogin(login, login);
LoginWindow.invalidate(LoginWindow.INNER);
}
void logout() {
ctt_login.logout(session);
LoginWindow.invalidate(LoginWindow.INNER);
}
</zscript>
<caption unless="${noSessionUser}">
<toolbarbutton label="logout" onClick="logout()"/> </caption>
<grid if="${noSessionUser}">
<rows>
<row>
Login Name: <textbox id="login" />
</row>
<row>
Passwort: <textbox id="password" type="password" />
</row>
<row>
<button label="Login" onClick="submit()" onOk="submit()"/>
</row>
</rows>
</grid>
</window>
Probably i have to call
noSessionUser = (Boolean)!ctt_login.hasSessionUser(session);
again, before i invalidate the window... i tried to call it direct in the if and unless attributes, but i didnt found the right syntax... :-(
BTW... submit calls my login form constrain, which makes the overall checks of the form and throws the WrongValueException to the texboxes, which caused the error...
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665248
By: oberinspector
and what also doesn't work... i want to submit the form when i press enter on my keyboard... i placed the onOk="submit" in the window and in the button...
nothing happens, when the focus is not on the button...
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665255
By: tomyeh
onOK, not onOk
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665258
By: tomyeh
First, zscript is evaluated only once when the page is loaded. So, you have to update noSessionuser when logout.
Second, EL expression (what is specified in the if and unless attribute) has some limitation that it cannot handle member function calls. I guessed you are hitting this. However, some builtin variables could help you to access attributes, such as
if="${sessionScope.login}"
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665268
By: oberinspector
sessionScope looks fine... Thanks!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665299
By: oberinspector
<grid if="${sessionScope.SESSION_USER==null}"> is correct evaluated. invalidate forces a redraw, but the if attribute seems not to be evaluated again in this case... when i do a browser reload it works...
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665356
By: tomyeh
Yes, it is evaluated only once.
The whole page is evaluated only once when it is loaded. Then, it reponses to events as you registered.
In your case (to evaluate the whole page again), you have to invoke
page.recreate(null) (see Page's javadoc). It removes all components and recreate them based on the page definition.
Asked: 2006-04-02 07:56:20 +0800
Seen: 651 times
Last updated: Apr 03 '06