VoiceXML 2.1 Development Guide Home  |  Frameset Home


<block>  element


The block element is simply a form-item container element for executable content, which executes if the condition of the item is equal to ‘true’.


usage

<block cond="CDATA" expr="CDATA" name="NMTOKEN">


attributes

cond Data Type: CDATA Default: Optional (true)
The cond attribute specifies a Boolean expression, which must equate to ‘true’ in order for the content to be visited and executed. (Additionally, the expr attribute must also be set to ‘undefined’, see below).
expr Data Type: CDATA Default: Optional
The expr attribute specifies the initial value of  the element; if this value is ‘undefined’, (default), then the element will be visited by the FIA and executed. If  this attribute has a  value other than ‘undefined’, then the element will not be visited until explicitly set to 'undefined', by use of the clear element.
name Data Type: NMTOKEN Default: Optional
This contains the value, or ‘ID’ of the block in question, which is used for navigational purposes within the application. In order to goto a specific block in an application, a block name is required.



shadow variables

none


parents

<form>


children

<assign>   <audio>   <clear>   <disconnect>   <enumerate>   <exit>   <goto>   <if>   <log>   <prompt>   <reprompt>   <return>   <script>   <submit>   <throw>   <value>   <var>


code samples

<Block cond-expr-name> 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="F_1">

  <block name="B_1" expr="'someValue'">
    <prompt>
      since the expression of the block is not undefined,
      this will be skipped by the interpreter.
    </prompt>
  </block>

  <block name="B_2" cond="false">
    <prompt>
      since the condition attribute is not set to true,
      this block will be skipped as well.
    </prompt>
  </block>

  <block name="B_3" cond="true" expr="">
    <prompt>
      since the condition attribute is set to true,
      and the expression is set to undefined this
      block will be visited.
    </prompt>
  </block>

</form>

</vxml>



additional links

W3C 2.0 Specification


  ANNOTATIONS: EXISTING POSTS
mihai.paiu
5/26/2005 4:49 AM (EDT)
Hello there.

I saw a lot of VXML that contain blocks like the one below:

<block>
    This is a test for a simple field
</block>

Should it be played (like a prompt) or just ignored ?
JimMurphy
5/26/2005 8:47 AM (EDT)
mihai.paiu,

According to the W3C, you can leave off the <prompt> tag in two cases:

1) You do not need to specify an attribute to <prompt>.
----- eg. you need to specify a bargein value or set conditionals. In these cases, you'd need to specify a <prompt bargein="false"> or
<prompt cond="var=='value'">

2) The prompt consists entirely of PCDATA (contains no speech markups) or consists of just an <audio> or <value> element.
----- if you have any other speech markup elements in the string to be spoken, you'll have to enclose them with the parent <prompt> element.

See more here:
http://www.w3.org/TR/2004/REC-voicexml20-20040316/#dml4.1

I hope that helps. If not, please let us know.

Jim
vinoth
5/9/2006 6:03 AM (EDT)
Hi,
  We have an example for block here and we are using one of the block attribute expr .
expr value should be like this "''".It should not be like "".
 
  This is not the major pblm but new comers will face the pblm.

Thanks
Vinoth R
ulaganathan.a
7/24/2006 6:48 AM (EDT)
Hi
I am new for VXML.Anybody explain about <block> in Vxml ? What is the purpose for the <block>?


Ulaganathan

sidvoxeo
7/24/2006 9:27 AM (EDT)
Hi there,
The <block> element is basically a <field> element with no variables.  It contains executable content that is processed if the block's input-form-item variable is undefined and the block's cond attribute, if any, evaluates to true.  After execution, its input-form-item variable is set to false so the FIA will not select the <block> element again for execution.  Normally, the <block> element is executed only once. 

You can find more examples and detailed documentation in our docs at
http://docs.voxeo.com/voicexml/2.0/ , look for the element block.
Let me know if you have any questions.
Thanks
Sid
raghu.ram
2/24/2007 2:14 AM (EST)
hi,
i dont know this is a simple problem or not,
im learning vxml, so im a beginner...
nway
how to pass a variable from one vxml file to another vxmlfile

thanks
--raghu
voxeojeff
2/24/2007 9:50 AM (EST)
Hi Raghu,

If you wish to pass variables from one file to another, there are a couple ways you can do this.

1.  Declare an application root document to store your global variables
2.  Pass variable information over to your other documents via the <submit> element with a namelist.

For example,

<submit next="SecondDocument.xml" namelist="Var1 Var2 Var3"/>

This will require the use of server-side, as with most detailed applications.

Cheers,

Jeff Menkel
Voxeo Corporation
prasad123
1/3/2008 3:09 AM (EST)
Hi,

I would like to know how to convert String type to number type in VoiceXML?
I am trying to implement news service where it reads news and asks the user to input the no. to select the news. When the selected news is being read, if the user says "next" in between, the browser should skip the current news and start reading next news.
I tried <goto nextitem> for it, but it couldn't work.

Can someone help me in this?

Thanks in advance,
Prasad

voxeojeff
1/3/2008 9:58 AM (EST)
Hi Prasad,

It sounds like you should implement a bargeintype of 'hotword', along with a simple in-line GSL grammar containing the word "next" to accomplish this task.  This will only recognize the word "next" and then go to the next page corresponding with the second news article.  For example,

<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1">

<form id="F1">

    <nomatch>
      <goto next="#F1"/>
    </nomatch>

    <noinput>
      <goto next="#F1"/>
    </noinput>

    <grammar type="text/gsl">
      <![CDATA[[
            [next]    {<F_1 "next">}
      ]]]>
      </grammar>

    <field name="F_1">

      <prompt bargeintype="hotword">
        Your news article can go here.  Only the word next will cause this to go to the next form or document.
      </prompt>

    <filled>
      <goto next="AnotherDocument.vxml#AnotherForm"/>
    </filled>

</field>

</form>
</vxml>

I hope this helps!  Let me know if you have any further questions here, I will be standing by to assist.

Regards,

Jeff
mtatum111
9/24/2008 10:50 PM (EDT)
What will be the value contained in B_3 after the block is executed?

I couldn't seem to find this in the specification.

<block name="B_3" cond="true" expr="">
    <prompt>
      since the condition attribute is set to true,
      and the expression is set to undefined this
      block will be visited.
    </prompt>
  </block>
jdyer
9/24/2008 11:31 PM (EDT)
Hi!

  I am not sure what you are asking here, are you asking if the value of expr="" changes once this block is visited?  If thats the case this value is undefined and as such this block will execute, however the value is not changed after this fact.  Additionally you can define a value here and then use the clear element to set that value to undefined so you can conditionally visit a block at that time. Hope that clears things up a bit for you, please let us know if there are any more questions!  We are here to help!

Regards,

John D.
Customer Engineer
Voxeo Support
mtatum111
9/25/2008 8:37 AM (EDT)
John, that is indeed what I am asking.  When you go through and <block> is executed for the first time, what gets set to keep it from executing the second time through the form.  Is expr set to a value, or is cond set to "false"

Thanks for any clarification.
mtatum111
9/25/2008 9:07 AM (EDT)
I believe I understand now.  I wrote a small test case and have the following

<block name="welcome">
  <prompt>Welcome to ABC Bank </prompt>
</block>

After this statement is executed then the expr attribute will then contain "true" .  Since, the expr attribute contains something other than undefined, then the block is skipped over.

It really helps me to be able to load samples on voxeo to see how it should behave.  This is a real lifesafer.  Thanks for all of your hard work and dedication in keeping this site going!
voxeojeremyr
9/25/2008 9:18 AM (EDT)
Hi,

Thanks for your kind words.  We are always happy to help out in case you have any other questions.

Happy Coding,
Jeremy Richmond
Voxeo Support
IngaLederer
12/12/2008 11:48 AM (EST)
Question on what qualifies as "Undefined".  Does the 0.0 in "expr = "0.0" qualify as undefined.  Also I saw undefined stated exp = ""  as undefined.  Are there anymore varieties of undefined?

<?xml version="1.0"?>
<vxml version="2.0">
    <form>
          <block name = "intro">
              <var name = "initial_balance" expr = "0.0" />
              <prompt>  <!-- demonstrate that initial_balance is initialized -->
                        The initial balance is <value expr="initial_balance"/>
              </prompt>
          </block>

          <!-- The rest of the code goes here -->
      </form>
</vxml>

voxeo_chris
12/12/2008 11:57 AM (EST)
Hello,

Undefined means that the variable currently doesn't hold any value.  So when you set the expr="", the variable isn't set and therefore undefined.  If set the expr="0.0", the value would be 0.0.  There are no varieties of undefined as undefined simply means that the variable doesn't hold an expression.  Let me know if this clears things up or if there is anything else we can help you with.

Regards,
Chris Bruckart
bongza
10/14/2009 6:36 AM (EDT)
Hi

Can I use goto next="#frm" inside a block? if not what can I use cos I have a block inside a form but I want to get out of the block and go to another form
voxeoJeffK
10/14/2009 7:02 AM (EDT)
Hello,

Yes, <goto> can be nested within <block>. The allowed parent elements for <goto> are:

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

and transitioning to another form should be possible as:

  <goto next="#AnotherForm"/>

Regards,
Jeff Kustermann
Voxeo Support
moshe
12/18/2009 6:29 AM (EST)
The "data" element is also a legal child of block.

login



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