22.1. Reset Buttons

HTML provides a way for you to create reset buttons. When a reset button is clicked, the form is reset to its default values. Unlike HTML, WML does not support the creation of reset buttons. However, you can use a way similar to what we described in the last section to create an anchor link that works like a reset button. Here is an example:


(resetButtonsEg1.wml)

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

<wml>
  <card id="card1" title="WML Form">
    <p>
      User name:<br/>
      <input name="myUserName"/><br/>

      Password:<br/>
      <input name="myPassword" type="password"/><br/><br/>

      <anchor>
        <go method="get" href="resetButtonsProc.asp">
          <postfield name="name" value="$(myUserName)"/>
          <postfield name="password" value="$(myPassword)"/>
        </go>
        Submit Data
      </anchor><br/>

      <anchor>
        <refresh>
          <setvar name="myUserName" value=""/>
          <setvar name="myPassword" value=""/>
        </refresh>
        Reset Form
      </anchor>

    </p>
  </card>
</wml>


The result of the above WML example in some mobile phone browsers is shown below:






Sony Ericsson T610





Sony Ericsson T68i





Nokia Mobile Browser 4.0


Enter something in the input fields, like this:



Sony Ericsson T610


Sony Ericsson T68i


Nokia Mobile Browser 4.0


If you click the "Reset Form" anchor link, the input fields will be reset to their default values.



Sony Ericsson T610


Sony Ericsson T68i


Nokia Mobile Browser 4.0


Previous Page Page 50 of 50


Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.

A button for going back to the top of this page