onreco Event

  Microsoft Speech Technologies Homepage

Occurs when a dual tone multi-frequency (DTMF) session ends.

HTML <dtmf onreco="recoHandler()">
Scripting dtmf.onreco = recoHandler;
Named Script <SCRIPT FOR = dtmf EVENT = onreco>

Remarks

A DTMF session ends when the proper number of digits has been collected or the interdigittimeout time-out has expired. The dtmfresult and text properties are filled with the Semantic Markup Language (SML) result and the collected digit string, respectively.

When an onreco event occurs, the DTMF session ends automatically without requiring an explicit call to the Stop method. In addition, any active listen element also stops.

The event handler for the onreco event is typically used for programmatic analysis of the recognition result and processing of the result into fields of an HTML page.

Although it does not receive properties directly, the event handler can query the status property of the dtmf element for data about the event.

Example

The following code demonstrates the use of the onreco event.

<html xmlns:salt="http://www.saltforum.org/2002/SALT">
  ...
  <body>
    <input type="text" name="iptAreaCode" onFocus="dtmfAreaCode.Start()" />
    <input type="text" name="iptPhoneNumber" />
    ...
    <salt:dtmf id="dtmfAreaCode" onkeypress="dtmfKeyPressHandler()" onreco="dtmfPhoneNumber.Start()"    onsilence="dtmfSilenceHandler()" onerror="dtmfErrorHandler()" onnoreco="dtmfErrorHandler()"    initialtimeout="5000" interdigittimeout="2000" preflush="true">
      <!-- grammar result will contain "smlAreaCode" node -->
      <salt:grammar src="3digits.grxml" />
      <salt:bind value="//smlAreaCode" targetelement="iptAreaCode" />
    </salt:dtmf>
    <salt:dtmf id="dtmfPhoneNumber" onkeypress="dtmfKeyPressHandler()" onerror="dtmfErrorHandler()"    initialtimeout="5000" interdigittimeout="2000" preflush="true">
       <!-- grammar result will contain "smlPhoneNumber" node -->
      <salt:grammar src="7digits.grxml" />
      <salt:bind value="//smlPhoneNumber" targetelement="iptPhoneNumber" />
    </salt:dtmf>
    <script language="jscript">
    <!--
      function dtmfSilenceHandler() {
        ...
      }
  
      function dtmfErrorHandler() {
        ...
      }
      
      function dtmfKeyPressHandler() {
        ...
      }
      -->
      </script>
  <body>
</html>

See Also

dtmf Element | prompt Element | grammar Element | dtmfresult Property | interdigittimeout Attribute | text Property