Share via


reprompt

reprompt element

Indicates that the Platform should select and queue the appropriate prompt element before entering a listen state in an interactive dialog.

Syntax

<reprompt />

Parents

block, catch, error, filled, foreach, help, if, noinput, nomatch, prompt

Children

None.

Remarks

Use the reprompt element within an event handler such as noinput, nomatch, or help to indicate that a prompt element should be selected and queued during the next iteration of the form.

The reprompt element has no effect within a filled element. To re-enter the dialog and get a prompt to be requeued after the form item has been filled, execute a clear on the form item.

Examples

In the following example, the reprompt element is used to queue the second prompt after the first noinput and nomatch occurs. After the second noinput and nomatch occurs, the prompt is not executed because the reprompt element is absent from the second noinput and nomatch handler.

<?xml version="1.0"?>
<vxml version="2.1"
 xmlns="http://www.w3.org/2001/vxml">
  <link event="event.exit">
  
  <grammar mode="voice"
         root="root_rule"
         tag-format="semantics/1.0"
         type="application/srgs+xml"
         version="1.0"
         xml:lang="en-US">
    <rule id="root_rule" scope="public">
      <one-of>
        <item>
          quit
        </item>
      </one-of>
    </rule>

  </grammar>

  </link>

  <link event="help">
  
  <grammar mode="voice"
         root="root_rule"
         tag-format="semantics/1.0"
         type="application/srgs+xml"
         version="1.0"
         xml:lang="en-US">
    <rule id="root_rule" scope="public">
      <one-of>
        <item>
          help
        </item>
      </one-of>
    </rule>

  </grammar>

  </link>

   <catch event="event.exit">
      <exit />
   </catch>

  <form id="pick_fruit">
    <block>
       Welcome to the fruit picker. Say quit at any time.
    </block>

    <field name="fruit">

      <prompt count="1">
        Pick a fruit.
        <break size="medium"/>
      </prompt>

      <prompt count="2">
        Say the name of a fruit. For example, say apple.
        <break size="medium"/>
      </prompt>

      
      <grammar mode="voice"
         root="root_rule"
         tag-format="semantics/1.0"
         type="application/srgs+xml"
         version="1.0"
         xml:lang="en-US">
            <rule id="root_rule" scope="public">
                  <one-of>
                        <item>
                              <one-of>
                                    <item>
                                          apple
                                    </item>
                              </one-of>
                              <tag>out.fruit = "apple";</tag>
                        </item>
                        <item>
                              <one-of>
                                    <item>
                                          orange
                                    </item>
                              </one-of>
                              <tag>out.fruit = "orange";</tag>
                        </item>
                        <item>
                              <one-of>
                                    <item>
                                          pear
                                    </item>
                              </one-of>
                              <tag>out.fruit = "pear";</tag>
                        </item>
                  </one-of>
            </rule>

      </grammar>


      <help>
         You're in the fruit picker.
         <reprompt/>
      </help>

      <catch event="noinput nomatch">
        Sorry. I didn't get that.
        <reprompt/>
      </catch>

      <catch event="noinput nomatch" count="2">
        Sorry. I didn't get that.
        Please say apple, orange, or pear.
      </catch>

      <filled>
        You picked <value expr="fruit"/>
        <!-- clear the form item variable to pick another -->
        <clear namelist="fruit"/>
      </filled>

    </field>
  </form>
</vxml>