CallXML 3.0 Development GuideHome  |  Frameset Home


<cleardigits>  element

The digits buffer contains any touch-tone digits the user may have pressed before a CallXML action is executed. The 'cleardigits' element will clear the digit buffer of any queued digits.

In addition to the clearDigits element and the ability to clear the digits buffer manually, several CallXML elements have a clearDigits attribute that does the same thing in order to reduce the number of elements required for common tasks.


usage
<cleardigits id="(element id)" test="CDATA" value-is="STRING" value-is-not="STRING">


attributes
idData Type: (element id)Default: none - attribute is optional
The new 'id' attribute in CallXML3.0 is applicable to all container and action elements. Specifying this attribute allows yet another level of control and event handling when events occur and are caught by the <on> element. When an event occurs, the handler will first check the event, and then verify that the handler has a handler specific to the 'id' attribute to execute. This allows the developer to plan a specific course of action for events based on where in the application that they occur.
testData Type: CDATADefault: Optional
The 'test' attribute is a new supplement to the CallXML markup that permits the developer to execute the contents of a container element, or action element, based on whether or not the specified condition is met. If the defined condition is met, then the code contained within the element is then executed. If the condition is not met, then the application resumes execution with the next sequential container container element in the document.
value-isData Type: STRINGDefault: none - attribute is optional
Another new attribute, 'value-is', grants the developer with the ability to perform conditional logic upon container elements, or action elements for the first time within the CallXML markup. The value specified in the 'value-is' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is' equate to 'true', then the element specified will execute. If the value equates to 'false' then the element will be skipped during document execution.
value-is-notData Type: STRINGDefault: none - attribute is optional
Another new attribute, 'value-is-not', grants the developer with the ability to perform conditional logic upon container elements, or action elements, for the first time within the CallXML markup. The value specified in the 'value-is-not' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is-not' equate to 'false', then the element specified will execute. If the value equates to 'true' then the element will be skipped during document execution.



code samples
<3.0 cleardigits-valueis>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">

  <do label="B1">

    <prompt>
      Enter four digits here.
    </prompt>

    <getdigits var="Var_1" maxdigits="3"
      includetermdigit="true"/>

    <on event="maxdigits">
      <say>
        say, you must have pressed $Var_1;
      </say>

      <goto value="#B2"/>
    </on>

  </do>

  <do label="B2" value="foo">

<!-- if we do *not* include a cleardigits element -->
<!--  the fourth keypress from B1 will automatically -->
<!-- populate the getdigits field in this block -->


<!-- this will execute, because  foo is equal to foo -->
  <cleardigits value-is="foo"/>

<!-- this will also execute,(redundantly) because -->
<!--  foo is not equal to bar -->
    <cleardigits value-is-not="bar"/>


<!-- neither of these would execute at all -->
<!--
    <cleardigits value-is="bar"/>
    <cleardigits value-is-not="foo"/>

-->

    <prompt>
      Enter 1 digit here.
    </prompt>

    <getdigits var="Var_2" maxdigits="1"
      includetermdigit="true"/>

    <on event="maxdigits">
      <say>
        second get digits filled with a value of $Var_2;
      </say>
    </on>

  </do>

</callxml>



<3.0 cleardigits-test>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">

  <do label="B1">

    <prompt>
      Enter four digits here.
    </prompt>

    <getdigits var="Var_1" maxdigits="3"
      includetermdigit="true"/>

    <on event="maxdigits">
      <say>
        say, you must have pressed $Var_1;
      </say>

      <goto value="#B2"/>
    </on>

  </do>

  <do label="B2">

<!-- if we do *not* include a cleardigits element -->
<!--  the fourth keypress from B1 will automatically -->
<!-- populate the getdigits field in this block -->


<!-- this will execute, because  '1' is equal to '1' -->
  <cleardigits test="1 = 1"/>

<!-- this will also execute,(redundantly) because -->
<!--  '1' is not equal to '2' -->
    <cleardigits test="1 != 2"/>


<!-- neither of these would execute at all -->
<!--
    <cleardigits test="1=2"/>
    <cleardigits test="&apos;foo&apos; = &apos;bar&apos;"/>

-->

    <prompt>
      Enter 1 digit here.
    </prompt>

    <getdigits var="Var_2" maxdigits="1"
      includetermdigit="true"/>

    <on event="maxdigits">
      <say>
        second get digits filled with a value of $Var_2;
      </say>
    </on>

  </do>

</callxml>





additional links
none


  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login



© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site