Compartir a través de


OnClientConfirmed Property

  Microsoft Speech Technologies Homepage

Gets or sets the name of a client-side function that is called when the value of the SemanticItem control is confirmed. Read/write.

Usage

ASP.NET markup: <speech:SemanticItem OnClientConfirmed="..." />
Get value: String = SemanticItem.OnClientConfirmed;
Set value: SemanticItem.OnClientConfirmed = String;
Data type: String
Required: No

Remarks

If AutoPostBack is set to True, the OnClientConfirmed function is executed before posting back to the server. If the author wants to persist any page state across postback, the OnClientConfirmed function is a good place to access the ClientViewState object of RunSpeech.

The value of the OnClientConfirmed property is the name of a custom client-side script function, without parameters or parentheses. The client-side dialog manager calls this function, using the following syntax, when the Text of the SemanticItem is confirmed.

The script block that contains this function should be placed before the control that calls the function. For more information, see "Placement of Script Blocks" in Authoring Notes.

Syntax

function FunctionName ( object SemanticItem )
{
     // Client-side code referenced by SemanticItem.OnClientConfirmed
}

Parameters

  • SemanticItem
    The client-side SemanticItem object.

Return Value

None.

Example

The following example is adapted from the Speech Controls ListSelector and YesNo sample.

<script>
  //
  //Restarts selection dialog if user wants to try again.
  //
  function onYesNo() {
    if(SemanticItem2.value == "Yes"){
      SemanticItem1.Clear();
      SemanticItem2.Clear();
    }
  }
</script>

<form id="Form1" method="post" runat="server">
  ...
  <asp:dropdownlist id=DropDownList1 runat="server" 
    DataSource="<%# aWords %>">
  </asp:dropdownlist>
  <asp:textbox id="TextBox1" runat="server" ></asp:textbox>
  
  <speech:semanticmap id="SemanticMap1" runat="server">
    <speech:SemanticItem id="SemanticItem1" runat="server" >
    </speech:SemanticItem>
    <speech:SemanticItem id="SemanticItem2" runat="server" 
      OnClientConfirmed="onYesNo">
    </speech:SemanticItem>
  </speech:semanticmap>
  
  <speech:qa id="Welcome" runat="server"
      PlayOnce="True" AllowCommands="False">
      <Prompt InlinePrompt="Welcome to our online dictionary"></Prompt>
  </speech:qa>
  
  <speech:ListSelector id=SingleItemChooser1 runat="server" 
    DataSource="<%# aWords %>" 
    PromptSelectFunction="selectionPromptSelectFunction"
    OnClientCompleteLast="onSelectionComplete" 
    SemanticItem="SemanticItem1" 
    QuestionPrompt="Which word would you like defined?" 
    FirstInitialTimeout="0">
  </speech:ListSelector>
  
  <speech:qa id="Definition" runat="server" AllowCommands="False">
      <Prompt PromptSelectFunction="definitionPromptSelectFunction">
      </Prompt>
  </speech:qa>
  
  <speech:yesno id="YesNo1" runat="server"
      SemanticItem="SemanticItem2" 
      QuestionPrompt="Would you like to know more about another word?"
      FirstInitialTimeout="0">
  </speech:yesno>
  
  <speech:command id="Command1" XPathTrigger="//Help" 
    Type="Help" Scope="WebForm1" runat="server">
    <Grammar Src="./Grammars/HelpGlobalCommand.grxml"></Grammar>
  </speech:command>
  ...
</form>

See Also

SemanticItem Class | SemanticItem Constructor | SemanticItem Members | SemanticItem Properties | SemanticItem Methods | SemanticItem Events | SemanticItem Remarks | SemanticItem Client Object