next up previous
Next: Conditional text
Up: More examples
Previous: A counter

Menus

This page demonstrates a menu which translates string selections into numbers, and another which contains a big sequence of integers written compactly as a list. At the end of the page is a form which can dynamically change the options on the first menu by allowing the user to add new options.

<!-- Menus.wom -->

<HTML>
<HEAD><TITLE>Menus</TITLE></HEAD>
<BODY>
<H1>Menus</H1>

<WOMForm>
  Pick an action from the menu and apply it to the number below.<BR>
  <RealMenu action options={"Halve it":0.5,"Double it":2,"Treble it":3}
                   display="Double it"
                   value=2
  ><BR>
  <Text x value="1"><BR>
  <INPUT TYPE=SUBMIT>
  <OnSubmit rexx>
  { $x~setValue($x~getValue*$action~getValue) }
  </OnSubmit>
</WOMForm>

<HR>

<WOMForm>
  Pick a number.
  <IntegerMenu y options={0 to 10,12 to 18 by 2,"Twenty":20}
                 display=0
                 value=0
  ><BR>
  <Text message value=""><BR>
  <INPUT TYPE=SUBMIT>
  <OnSubmit rexx>
  { $message~setValue("You chose" $y~getValue) }
  </OnSubmit>
</WOMForm>

<HR>

<WOMForm>
  Type an action name (e.g. "quadruple it")
  and a number (e.g. 4) to add to the first
  menu above.<BR>
  Action: <TextField action_name><BR>
  Number: <RealField action_value><BR>
  <INPUT TYPE=SUBMIT>
  <OnSubmit rexx>
  { $action~setOption( $action_name~getValue,,
                       $action_value~getValue,
                     )
  }
  </OnSubmit>
</WOMForm>

</BODY>
</HTML>



Jocelyn Ireson-Paine
Fri May 30 14:03:06 BST 1997