|
Jack's Hack for the month of January, 2002: Preventing users from backing up into cards they should not have to revisit. Users come to rely and feel less apprehensive using an application that has good backward navigation functions available. Allowing users to navigate backwards permits leaving an application without having to return to the home deck. This may be particularly helpful for applications that may be deeply embedded in the browser. For example, if a set of applications is 3 menus deep from the home card, backward navigation will allow the user to easily get to the start of the set without having to re-navigate through the first 2 ? 3 menus. In some cases, backward navigation must be carefully considered and designed such as, prohibiting navigation behind password protected cards. There are a couple of ways to prevent users from navigating backwards into a card:
Option 1, accelerate the user up the history stack <card id="main"> .... <option onpick="#pwentry">Log In</option> ... </card> <card id="pwentry" title="Login"> <onevent type="onenterbackward"> <prev/> </onevent> <do type="accept" label="login"> <go href="/validatelogin.jsp"> <postfield name="user" value="$uid"/> <postfield name="passwd" value="$password"/> </go> </do> <p> Please Login:<br/> user: <input name="uid" title="User ID"/> password: <input name="password" title="Password"/> </p> </card> -- result of validatelogin.jsp -- .... <card id="success"> <onevent type="onenterforward"> <go href="loggedin.jsp"> </onevent> <onevent type="onenterbackward"> <prev/> </onevent> <p>Login Success!</p> </card> ... In the code fragment above, after the user fills in the input fields and
invokes the accept action they are sent on to a script (validatelogin.jsp).
Assuming that this script process successfully, the user will be redirected to
"loggedin.jsp". If the user presses the "back" key on the phone, the browser
will navigate up the history stack, and the Option 2, use activities to drop the password card off the history stack completely <card id="main"> .... <option> <onevent type="onpick"> <spawn href="#pwentry" onexit="loggedin.jsp"> <catch/> </spawn> </onevent>Log In</option> ... </card> <card id="pwentry" title="Login"> <do type="accept" label="login"> <go href="/validatelogin.jsp"> <postfield name="user" value="$uid"/> <postfield name="passwd" value="$password"/> </go> </do> <p> Please Login:<br/> user: <input name="uid" title="User ID"/> password: <input name="password" title="Password"/> </p> </card>
-- result of validatelogin.jsp --
....
<card id="success">
<onevent type="onenterforward">
<exit/>
</onevent>
<p>
Login Success!
</p>
</card>
...
There are three cards of importance displayed in this sequence to
demonstrate the use of the For more detail about the |