VoiceXML 2.1 Development Guide Home  |  Frameset Home


<clear>  element


The clear element is used to set any existing VoiceXML variable or element guard variables to an undefined value, such as any user-defined variable set with the var or assign tags. The clear element can also be used to clear any block, subdialog, menu, record, transfer, or field guard variables, thus, programmatically allowing a caller to revisit these form items.


usage

<clear namelist="NMTOKEN">


attributes

namelist Data Type: NMTOKEN Default: Optional
The ‘namelist’ attribute allows you to specify particular variables or guard variables to be cleared upon execution. If none are explicitly set within this attribute, then all form items in the current form are cleared by default.



shadow variables

none


parents

<block>   <catch>   <error>   <filled>   <help>   <if>   <noinput>   <nomatch>


children

none


code samples

<Clear namelist> sample
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1">

<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>


<form id="F1">

  <field name="F_1">
    <prompt>
      which affliction plagued George W Bush as a child. was it chronic
      bedwetting, or cooties?
    </prompt>

    <grammar type="text/gsl">[(?chronic bedwetting) cooties]</grammar>

    <filled>
      <prompt>
        our variables value is <value expr="F_1"/>.
      </prompt>
    </filled>
  </field>

  <block>
    <clear namelist="F_1"/>
    <prompt>
      but, after clearing it, it is <value expr="F_1"/>
    </prompt>
    <disconnect/>
  </block>

</form>

</vxml>



additional links

W3C 2.0 Specification


  ANNOTATIONS: EXISTING POSTS
medicaone
3/18/2004 12:42 AM (EST)
Not researched but observed: It appears that <clear/> placed in a <catch/> block in the 2.0 Motorola browser causes an 'internal error in the gateway software". The same construct worked in the 1.3 Nuance browser.

Example:
<catch event="com.xyzcorp.voice.help">
<clear/>
<prompt>
help text goes here
</prompt>
<reprompt/>
</catch>
willigar
1/5/2007 2:41 PM (EST)
I'm seconding what medicaone observed, namely that you can't add <clear> to a catch block. In my case, the <clear> had no namelist specified and was at the document level. When I moved it to the form level, all worked fine (although that doesn't solve my problem). I haven't investigated whether it would work at doc level with a namelist specified.
MattHenry
1/5/2007 5:58 PM (EST)


Greetings gents,

I have verified this behavior as well,and have opened up bug ticket [b]#207734[/b] to track this issue to resolution. When we have deployed a fix for this, I'll be sure to post back to you so that you can make sure the problem no longer manifests itself.

I did verify that specifying a 'namelist' attribute allows you to effectively work around this behavior, however, (see attached).

Regards,

~Matthew Henry
djsteveoid
5/6/2009 3:32 PM (EDT)
Is there an update on this? I'm still seeing the same bug where <clear/> in a <catch> doesn't work. I tried making the clear block <clear namelist=""/> but that doesn't work either.

Thanks,
-Steve
VoxeoDustin
5/6/2009 3:48 PM (EDT)
Hey Steve,

This is actually working according to the spec.

From section 5.3.3 (Voice Extensible Markup Language (VoiceXML) Version 2.0)

"The <clear> element resets one or more variables, including form items. For each specified variable name, the variable is resolved relative to the current scope"

and

"The list of variables to be reset; this can include variable names other than form items. If an undeclared variable is referenced in the namelist, then an error.semantic is thrown (Section 5.1.1). When not specified, all form items in the current form are cleared."

So the specs says that when no namelist is specified only the form items should be cleared (and not the (user) variables). Basically, if you're issuing <clear> with no namelist inside of a <catch>, unless that catch is scoped within a field, block, transfer or record, this will have no effect. If you wish to clear the value of a form item from within a catch, you'll want to use the namelist attribute with a space-delimited list of the form items you wish to clear.

Let me know if we can be of further assistance.

Regards,
Dustin Hayre
Customer Support Engineer II
Voxeo Support
djsteveoid
5/6/2009 4:40 PM (EDT)
Thanks, Dustin. That is helpful.

In a <catch> block, do I need to clear the event itself?

-Steve
VoxeoDustin
5/6/2009 4:45 PM (EDT)
Hey Steve,

That's not necessary. Event handlers are handled by the form interpretation algorithm differently and don't need to be cleared in order to be executed a second time.

Regards,
Dustin Hayre
Customer Support Engineer II
Voxeo Support

login



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