| Main Menu | Section Menu | Syllabus | Previous |  |  | Next | 
| Directed Forms | Page 6 of 7 | 
The simplest and most common type of form is one in which the form items are executed exactly once in sequential order to implement a computer-directed interaction. Here is a weather information service that uses such a form.
 <form id="weather_info"> <block>Welcome 
      to the weather information service.</block> <field name="state"> 
      <prompt>What state?</prompt> <grammar src="state.grxml" type="application/grammar+xml"/> 
      <catch event="help"> Please speak the state for which you want the 
      weather. </catch> </field> <field name="city"> <prompt>What 
      city?</prompt> <grammar src="city.grxml" type="application/grammar+xml"/> 
      <catch event="help"> Please speak the city for which you want the 
      weather. </catch> </field> <block> <submit next="/servlet/weather" 
      namelist="city state"/> </block> 
      </form> 
    This dialog proceeds sequentially:
C (computer): Welcome to the weather information service. What state?
H (human): Help
C: Please speak the state for which you want the weather.
H: Georgia
C: What city?
H: Tblisi
C: I did not understand what you said. What city?
H: Macon
C: The conditions in Macon Georgia are sunny and clear at 11 AM ...
 The form interpretation algorithms first iteration selects the first 
      block, since its (hidden) form item variable is initially
      undefined. This block outputs the main prompt, and its form item variable 
      is set to true. On the FIAs second
      iteration, the first block is skipped because its form item variable is 
      now defined, and the state field is selected
      because the dialog variable state is undefined. This field prompts the user 
      for the state, and then sets the variable
      state to the answer. The third form iteration prompts and collects the city 
      field. The fourth iteration executes the final
      block and transitions to a different URI.
 Each field in this example has a prompt to play in order to elicit a response, 
      a grammar that specifies what to listen
      for, and an event handler for the help event. The help event is thrown whenever 
      the user asks for assistance. The
      help event handler catches these events and plays a more detailed prompt.
    
| Main Menu | Section Menu | Syllabus | Previous |  |  | Next |