| VoiceXML 2.1 Development Guide | Home | Frameset Home |
| id | Data Type: ID | Default: Optional |
| The id attribute specifies the navigational identifier of the form element. Once specified, the developer can assign the id as a destination of any goto statement. | ||
| scope | Data Type: (dialog|document) | Default: Dialog |
| The scope attribute denotes the scope of any grammars contained within the form. If set to ‘dialog’, (default), then all form grammars will only be active within the current form. If set to ‘document’, then the grammars will be considered active throughout the current page of VoiceXML code. If, however, the scope is set to ‘document’ in the application root document, then the grammar will be active throughout the entire application. | ||
| <?xml version="1.0" encoding="UTF-8" ?>
<vxml version = "2.1" xmlns="http://www.w3.org/2001/06/vxml"> <meta name="copyright" content="2012 voxeo corporation"/> <meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/> <form id="F1" scope="document"> <grammar xml:lang="en-us" root="myrule" scope="document"> <rule id="myrule"> <item> David Hasselhoff <tag> out.MySlot="Dave"</tag></item> </rule> </grammar> <!-- The utterance of 'david hasselhoff' anywhere in the application will fill this namelist--> <filled namelist="MySlot"> <goto next="#F3"/> </filled> <field name="F_1"> <grammar xml:lang="en-us" root="myrule"> <rule id="myrule"> <item> Moe Green </item> </rule> </grammar> <prompt> Who should get the next crack at playing Hamlet? His initials are d h. </prompt> </field> <filled namelist="F_1"> <prompt> You said <value expr="F_1"/> Are you insane? </prompt> <goto next="#F2"/> </filled> <!-- this empty field matching the form grammar's slot is required --> <field name="MySlot"/> </form> <form id="F2" scope="dialog"> <field name="F_2"> <grammar xml:lang="en-us" root="myrule"> <rule id="myrule"> <item> George Jones </item> </rule> </grammar> <prompt> Who is the biggest celebrity in germany? </prompt> <filled> <prompt> Now thats just crazy talk. </prompt> </filled> </field> <!-- This empty field matching the form grammar's slot is required. --> <field name="MySlot"/> </form> <form id="F3"> <block> <prompt> Our form level grammar has been filled. </prompt> </block> </form> </vxml> |
| ANNOTATIONS: EXISTING POSTS |
shawnaslam1
|
|
| Can we assign dynamic value to the form like if i want to assign form id as abc1 and 1 value is dynamic then how can we do this.
is that the feasible way <var name="i" expr="'1'"/> <form id="abc"+i> |
|
MattHenry
|
|
|
Hi Shawn, I'm really sorry, but this is not possible when using client-side scripting methods. However, you can populate a form ID with a dynamic value if you choose to implement a JSP (or whatever) backend. ~Matt |
|
shawnaslam1
|
|
| you mean like the following way
<form id="callJSPfunction"> callJSPfunction() { return formabc1; } so the name of the VXML form will be "formabc1" is that right interpretation |
|
MattHenry
|
|
|
Hello Shawn, I am sorry, but I am not familiar with JSP-specific coding methods, nor do we really offer technical support for anything other than the XML-based IVR markups that we host. Assuming that your code below will populate a dynamic variable value to the form id attribute, then this should be what you will want to do. ~Matt |
|
jefo12
|
|
|
suppose i hav one form1 and in that i hav fied1,field2,field3... and form2 in that i hav field4,field5,field6.. Is it possible to go to field 4 of form 2 directly from form 1 plz suggest me.... |
|
voxeojohnq
|
|
| Hey jefo,
Good news! There is in fact a way to jump around to different fields in different forms within the same document. Although, it is not as simple as using a <goto> to jump to the beginning of a seconds form. In this case, you would have to set up a "next field" type variable. This would hold the name of the field in the next form that you would want to go to. So what happens is that when you are ready to leave the first form, you would fill the "next field" variable. Then, you jump to the next form. Once there, you check the "next field" variable to see if it has a field name in it. If it does, you do a <goto expritem="" /> to jump to the desired field. In case that was a little cryptic, I wrote a sample vxml script to help you out. <?xml version="1.0" encoding="UTF-8" ?> <vxml version="2.1"> <!-- This is the next field varaible set this to whatever field you want to goto or leave it blank to start at the beginning of the form --> <var name="next_field" /> <form id="form1"> <field name="field1"> <grammar type="text/gsl">[[ dtmf-1 ]]</grammar> <prompt>This is field 1</prompt> <filled> <prompt>filled</prompt> <!-- YAY we filled the grammar!!--> <!-- set the next field variable to the desired field --> <assign name="next_field" expr="'field3'" /> <goto next="#form2" /> </filled> </field> </form> <form id="form2"> <block> <prompt><value expr="next_field" /></prompt> <!-- check to see if next field has a field name in it --> <if cond="next_field != ''"> <!-- it is filled! goto the next field!! --> <goto expritem="next_field" /> </if> </block> <field name="field2"> <grammar type="text/gsl">[[ dtmf-1 ]]</grammar> <prompt>This is field 2</prompt> </field> <field name="field3"> <grammar type="text/gsl">[[ dtmf-1 ]]</grammar> <prompt>This is field 3</prompt> <exit /> </field> </form> </vxml> I hope this helps you out! If you have any further questions, please don't hesitate to ask. Regards, John Quinn Voxeo Support |
|
mho
|
|
| Is there a way to find the ID of a form inside the form? For example is there something like:
<form id="myform1"> <block> <log expr="'I just entered from '+this.id"/> </block> </form> |
|
VoxeoIanHannah
|
|
| Hey Mho,
I'm not really sure what you are trying to do with a reference function like this, but I'll try answer as best as possible. As per the spec for <form>, that type of search is not supported. If you are looking for a search reference to find out where you are in your document, you could create a voice XML document scaled variable and have that point to the location in your program. Another option would be to create a dynamically generated file through something like PHP and have there be a connection within your static VXML document. Hopefully this gives you some ideas on how to proceed. Regards, Ian Hannah Voxeo Customer Obsession Team |
|
srini_v
|
|
| Hi,
I come across of the following in the FIA description "If an input matches a grammar in a form other than the current form, then the FIA terminates, the other form is initialized, and that form's FIA is started with this input in its process phase." Could you please let me know how one can activate more than one form at the same time? Thanks in advance Regards, Srinvias Vummentala |
|
MattHenry
|
|
|
Hello Srinvias, I think it might be helpful to inquire as to exactly what you are hoping to achieve by having two forms active: I'm not completely sure how to answer your question as it is stated, but my initial answer would be that "the W3C spec doesn't allow this behavior"...however, if I can get an idea as to what your end-goal is in this regard, perhaps I can offer some suggestions. ~Matthew Henry |
|
ravia
|
|
| Dear Folks,
Please let me know if it is legal to have an '-' (minus sign) in the form id attribute. xml allows for attributes to have this, however is this permitted in the id attribute. Your response is appreciated. Thanks. Regards, Ravi. |
|
MattHenry
|
|
|
Yes, this works as illustrated by the case I just tested: <form id="fifty-yard-DASH"> <block> <log expr="'*** YAY THIS WORKS ***'"/> </block> </form> Matthew Henry |
|
mageshnatarajan
|
|
| Form should have <data> as valid child. I'm seeing <form> as valid parent in <data> tag. Is there anything done intentionally. | |
MattHenry
|
|
|
Good catch; thanks for bringing this oversight to our attention. I have corrected this in our internal doc build, and as soon as we push this out, the correction will be made public. Matthew Henry |
| login |