help

help element

Handles a help event.

Syntax

<help 
cond = "ECMAScript_Expression"
count = "integer"
/>

Attributes

cond

A condition that must evaluate to true for this element to be selected by the form interpretation algorithm.

count

Used by the VoiceXML interpreter in the event handler selection process, allowing the developer to handle multiple occurrences of an event in a unique manner. The default value is 1.

Parents

field, form, initial, menu, object, record, subdialog, transfer, vxml

Children

assign, audio, break, clear, data, disconnect, enumerate, exit, foreach, goto, if, log element, mark, prompt, reprompt, return, script, submit, throw, value, var

Remarks

The help event handler catches a help event. A help event occurs when the user says "help" and an active grammar contains the utterance "help" and returns the value "help". The help event can also be fired from a link element.

The help element is shorthand for a catch element with its event attribute set to "help."

Tellme Studio automatically enables the help event. It also provides a default help event handler. You should override this handler with help information specific to each interactive dialog in your application.

Examples

The following example asks the user to say the name of a fruit. If the user says "help", the help handler instructs the user on what fruits she can say.

<?xml version="1.0"?>
<vxml version="2.1"
 xmlns="http://www.w3.org/2001/vxml">
   <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 weight="1.0">
                              help
                        </item>
                  </one-of>
            </rule>

      </grammar>

      
      <grammar mode="dtmf"
         root="root_rule"
         tag-format="semantics/1.0"
         type="application/srgs+xml"
         version="1.0">
            <rule id="root_rule" scope="public">
                  <one-of>
                        <item>
                              0
                        </item>
                  </one-of>
            </rule>

      </grammar>

   </link>

   <form id="pick_fruit">

   <field name="fruit">
      <prompt>
      Pick a fruit
      </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>
                        <item>
                              <one-of>
                                    <item>
                                          repeat
                                    </item>
                              </one-of>
                              <tag>out.fruit = "repeat";</tag>
                        </item>
                  </one-of>
            </rule>

      </grammar>


      <!-- handle all help events for this field -->
      <help>
         
         You're picking a fruit. 
         To pick a fruit, say apple, orange, or pear.
         
         <reprompt/>
      </help>

      <!-- handle all noinput events for this field -->
      <noinput>
         I'm sorry. I didn't hear you.
         <reprompt/>
      </noinput>

      <!-- handle all nomatch events for this field -->
      <nomatch>
         I'm sorry. I didn't get that.
         <reprompt/>
      </nomatch>

      <filled>
      <log>Recognized <value expr="fruit"/></log>
      <if cond="'repeat' == fruit">
         <clear namelist="fruit"/>
         <reprompt/>
      <else/>
         you chose <value expr="fruit"/>
         <exit />
      </if>
      </filled>

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

The following example defines a document level link that fires the help event when the user says "help."

<?xml version="1.0"?>
<vxml version="2.1"
 xmlns="http://www.w3.org/2001/vxml">

   <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 weight="1.0">
                              help
                        </item>
                  </one-of>
            </rule>

      </grammar>

      
      <grammar mode="dtmf"
         root="root_rule"
         tag-format="semantics/1.0"
         type="application/srgs+xml"
         version="1.0">
            <rule id="root_rule" scope="public">
                  <one-of>
                        <item>
                              0
                        </item>
                  </one-of>
            </rule>

      </grammar>

   </link>

   <form id="pick_fruit">

   <field name="fruit">
      <prompt>
      Pick a fruit
      </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>
                        <item>
                              <one-of>
                                    <item>
                                          repeat
                                    </item>
                              </one-of>
                              <tag>out.fruit = "repeat";</tag>
                        </item>
                  </one-of>
            </rule>

      </grammar>


      <!-- handle all help events for this field -->
      <help>
         
         You're picking a fruit. 
         To pick a fruit, say apple, orange, or pear.
         
         <reprompt/>
      </help>

      <!-- handle all noinput events for this field -->
      <noinput>
         I'm sorry. I didn't hear you.
         <reprompt/>
      </noinput>

      <!-- handle all nomatch events for this field -->
      <nomatch>
         I'm sorry. I didn't get that.
         <reprompt/>
      </nomatch>

      <filled>
      <log>Recognized <value expr="fruit"/></log>
      <if cond="'repeat' == fruit">
         <clear namelist="fruit"/>
         <reprompt/>
      <else/>
         you chose <value expr="fruit"/>
         <exit />
      </if>
      </filled>

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

See Also

Handling Events