EVENTS.

WML includes the possibility to do some tasks when an event occur.  For example when we go to some card, when a specified time expires, etc.

The first event we'll explain sounds a little familiar to us (we saw it in the last example), it performs an action when the user press a bottom, this
<DO>
element can be located at a deck (inside a template)  or at a card level. As we explained before a DO inside a card can override the one located at the template.

The <ONTIMER> event doesn't wait for a key press to make the task, it goes to a URL when a specified time expires. This time must be specified with a timer value, as you can see in the example

<?xml version="1.0"?>

<!DOCTYPE wml PUBLIC "WAPs" "www.homestead.com">
<wml>
          <card id="card1" ontimer="#card2" title="WAPs">
                     <timer value="12"/>
                     <p align="center">
                                <br/> <br/> <br/>
                                <big>
                                           The WAP
                                </big>
                     </p>
          </card>
          <card id="card2" ontimer="#card3" title="WAPs">
                     <timer value="12"/>
                     <p align="center">
                                <big>
                                           The WAP
                                           hole <br/>
                                </big>
                     </p>
          </card>
          <card id="card3" title="WAPs" onenterforward = "#card4" >
                     <p align="center">
                                <br/> <br/> <br/>
                                <big>
                                           <i>
                                                      The WAP hole Sun
                                           </i>
                                </big>
                     </p>
          </card>
          <card id="card4" title="WAPs">
                     <p align="center">
                                <br/> <br/> <br/>
                                <big>
                                           <i>
                                                      Press Back
                                           </i>
                                </big>
                     </p>
          </card>
</wml>

As you can see the ontimer defined in the card element sets the url where the program goes when the time defined expires.

<ONENTERFORWARD>, What the hell is it?

The OnEnterForward event occurs when you enter in a deck normally (forward). For example when we go from the 2nd deck to the third one. This event wont occur if we go from the third card to the second one (for example with the "go back" key).  In the example we go from the card "card2" to the card labeled "card3", the event "onenterforward" occurs and that card will not be executed, instead of that it goes to the card specify in the event (onenterforward = "#card4").

When the card "card4" is displayed we can go to card 3 pressing the "go back" key, and is now when we can see:
          "The WAP hole of the SUN"


The initial card is displayed during 12 units of time
The second card is displayed during 12 units of time
As the onenterforward event occurs, it jumps to the 4th card
Now pressing "Back" we came again to the third card, but this time the event is not triggered. (it is not enter forward)



[Create