Tech Tip: Checking for subsequent logins in dax_loginSuccess
PRODUCT: 4D Web 2.0 Pack | VERSION: 11.5 | PLATFORM: Mac & Win
Published On: April 16, 2010
The sample Javascript code below shows how to distinguish between first and other login callbacks via the dax_loginSuccess callback handler.
This is useful for cases where a customer logs in to the 4D Ajax Framework web application multiple times. It is common that certain UI elements should be initialized only on the first login (for example, data grids and navigation).
The following code checks if the first login session id is saved, and branches based on that. If it's not saved, it's assumed that this is first login, and the session id is preserved for next time.
// on first successful login save sessionId var initialSessionId; function dax_loginSuccess() { // check if this is first login if (!initialSessionId) { initialSessionId = dax_bridge.sessionId; // first login code goes here } else { // subsequent login code goes here } } |