OnClientComplete Property
Gets or sets the name of a client-side function that is called when execution of the QA control is complete. Read/write.
ASP.NET markup: | <speech:QA OnClientComplete="..." /> |
Get value: | String = QA.OnClientComplete; |
Set value: | QA.OnClientComplete = String; |
Data type: | String |
Required: | No |
The value of the OnClientComplete 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, after successful or unsuccessful completion of a QA, and before passing dialog control back to the RunSpeech algorithm.
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.
function FunctionName ()
{
// Client-side code referenced by QA.OnClientComplete
}
None.
None.
In the following example, a script function called TransferDomIntl is defined as the OnClientComplete event handler. The QA control asks the user "Would you like to book a domestic or an international flight?" The script tests the Value property of the SemanticItem containing the user's response and navigates to one of two pages, depending on the answer.
<script>
function TransferDomIntl () {
var DorI = siDomIntl.GetAttribute("Value");
if (DorI == "domestic") {
SpeechCommon.Navigate('DomesticFlights.aspx');
} else {
SpeechCommon.Navigate('InternationalFlights.aspx');
}
return(false);
}
</script>
<form id="Form1" method="post" runat="server">
...
<Speech:SemanticMap id="TheSemanticMap" runat="server">
<speech:semanticitem id="siDomIntl" runat="server" targetattribute="value" targetelement="tbDomIntl" ></speech:semanticitem>
</Speech:SemanticMap>
...
<speech:QA id="qaDomIntl" OnClientComplete="TransferDomIntl" runat="server">
<Prompt InlinePrompt="Would you like to book a domestic or an international flight?">
</Prompt>
<Answers>
<speech:Answer SemanticItem="siDomIntl" XPathTrigger="./DOMINTL"></speech:Answer>
</Answers>
<Reco InitialTimeout="3000" BabbleTimeout="10000" EndSilence="1000" MaxTimeout="30000" ID="Reco2">
<Grammars>
<speech:Grammar Src="Grammars/flight.grxml"></speech:Grammar>
</Grammars>
</Reco>
</speech:QA>
...
</form>
QA Class | QA Constructor | QA Members | QA Properties | QA Methods | QA Events | QA Remarks | QA Client Object