|
Author
|
Topic: voicexml grammar and script
|
loiy
Junior Member
Member # 3344
Rate Member
|
posted January 11, 2006 11:29 AM
can i use javascript in grxml? if yes how?
can one field have more than value?
thnks i kown now i can use javascript in grammar [ January 25, 2006, 01:29 PM: Message edited by: loiy ]
Posts: 3 | From: uln | Registered: Jan 2006
| IP: Logged
|
|
mheadd
Member
Member # 3181
Member Rated:
|
posted January 12, 2006 01:05 PM
> can i use javascript in grxml? if yes how?
I think the answer here is no � generally speaking, blocks of JavaScript code must be enclosed within script tags � I do not believe that this is supported within the Speech Recognition Grammar Specification. Not really sure why you would want to do this...
There are proposed changes in the VoiceXML 2.1 specification that will allow for the dynamic reference to grammar files using JavaScript expressions
> can one field have more than value?
Again, I think the answer here is no � generally speaking, a field variable has one value that is set when a successful match is made between the user�s input (either spoken or DTMF) and a grammar. Having said that, there are a few caveats:
1). It is possible to fill multiple slots (or fields designated with specific identifiers using the "slot" attribute) from a single prompt/grammar pair. This can be accomplished using a mixed initiative dialog. It can also be accomplished by using a multislot grammar.
2). Although a <field> will have only one returned value as a result of a grammar match, you can examine (and utilize) other properties of the <field> element using its shadow variables. For example, after a <field> is filled, you can determine the type of input used (variableName$.inputmode), its confidence level on recognition (variableName$.confidence), etc.
3). If you are attempting to collect multiple values to be submitted to a backend server for processing, you may be able to utilize a JavaScript Object to do this. You could repeatedly invoke the same dialog to prompt the user for input and then store that information in a JavaScript Object by setting its properties to the values given by the caller. You could then submit the data collected in this Object to a server for processing using the <submit> element.
A note of caution here, according to the VoiceXML 2.0 specification "If the variable [being submitted] is an ECMAScript Object the mechanism by which it is submitted is not currently defined." As such, different platforms may handle this differently. Here is one example -- I would recommend checking this out further before trying.
Hope this helps. [ January 13, 2006, 11:55 AM: Message edited by: mheadd ]
-------------------- Mark VoiceinGov.org http://www.voiceingov.org
Posts: 55 | Registered: Jun 2005
| IP: Logged
|
|
|