Plum DEV Documentation
voicexml:tags:form

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
voicexml:tags:form [2014/03/19 15:06]
adam [Parent Tags]
voicexml:tags:form [2015/07/31 14:14]
admin [<form>]
Line 1: Line 1:
- +{{description>​VoiceXML ‹form› details and VXML code example | Forms are key components of VoiceXML containing items, elements, variables, event handlers and actions.}} 
-=====<​form>​=====+======<​form>​======
  
 Forms are the key components of VoiceXML documents. A form contains: Forms are the key components of VoiceXML documents. A form contains:
Line 24: Line 24:
     <​block>​     <​block>​
       <​prompt>​       <​prompt>​
-        ​Jumping ​to the third form.+        ​Welcome! Let's move to form where we gather some input.
       </​prompt>​       </​prompt>​
       <!-- A "#"​ symbol followed by an identifier specifies a -->       <!-- A "#"​ symbol followed by an identifier specifies a -->
Line 31: Line 31:
     </​block>​     </​block>​
   </​form>​   </​form>​
 +
   <form id="​secondform">​   <form id="​secondform">​
     <​block>​     <​block>​
       <​prompt>​       <​prompt>​
-        ​Disconnecting.+        ​You've made it to the final form! Goodbye.
       </​prompt>​       </​prompt>​
       <​disconnect/>​       <​disconnect/>​
     </​block>​     </​block>​
   </​form>​   </​form>​
 +
   <form id="​thirdform">​   <form id="​thirdform">​
-    <block>+    <field name="​lucky_number"​ type="​digits?​length=1"​>
       <​prompt>​       <​prompt>​
-        ​Jumping to the second form.+        ​Enter your lucky number.
       </​prompt>​       </​prompt>​
-      <goto next="#​secondform"/>​ +      ​<​filled>​ 
-    </block>+        <​prompt>​ 
 +          Your lucky number is <value expr="​lucky_number"/>​. Let's move on to another form. 
 +        </​prompt>​ 
 +        ​<goto next="#​secondform"/​
 +      </​filled>​ 
 +      <catch event="​nomatch noinput"​ count="​1,​2">​ 
 +        <​prompt>​ 
 +          Your lucky number should be 1 digit. Let's try again. 
 +        </​prompt>​ 
 +        <​reprompt/>​ 
 +      </​catch>​ 
 +      <catch event="​nomatch noinput"​ count="​3">​ 
 +        <​prompt>​ 
 +          I guess you don't have a lucky number. Let's move on to the next form anyways. 
 +        </​prompt>​ 
 +        <goto next="#​secondform"/>​ 
 +      </catch
 +    </field>
   </​form>​   </​form>​
 </​vxml>​ </​vxml>​
 </​code>​ </​code>​
 +
 The output of the above script would be: The output of the above script would be:
  
-Computer: ​Jumping ​to the third form. \\ +Computer: ​Welcome! Let's move to form where we gather some input. \\ 
-Computer: ​Jumping ​to the second ​form. \\ +Computer: ​Enter your lucky number. \\ 
-Computer: ​Disconnecting. \\+User: <user enters: 3> \\ 
 +Computer: Your lucky number is 3. Let's move on to another ​form. \\ 
 +Computer: ​You've made it to the final form! Goodbye. \\