Hi
I have created one scratchpad to get four digits ( only numbers). The code as follows
<vxml version="2.0" >
<form id="frmTransferGetAmount">
<property name="termmaxdigits" value="false"/>
<field name="userinput" type="digits?length=4">
<grammar type="application/x-jsgf" xml:lang="en-GB" mode="dtmf">( 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 )</grammar>
<prompt> please enter four digits </prompt>
<filled>
<prompt> the number is <say-as type="acronym"> <value expr="userinput"/> </say-as>
</prompt>
</filled>
<nomatch>
<prompt> you should enter only four digits. </prompt>
<reprompt/>
</nomatch>
<noinput>
<prompt>you are entered any input.</prompt>
<reprompt/>
</noinput>
</field>
</form>
</vxml>
But i code accept asterisk and hash character. Please any one let me know what is the wrong in above code. i want allow the caller should enter only numbers
Thanks in Advance
We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics
Allow only Numbers
Re: Allow only Numbers
Hi,
The issue is with having an unnecessary <grammar> tag. By specifying <field name="userinput" type="digits?length=4">, you've already specified that you will only accept 4 digits from the user. Therefore, you can leave out the grammar tag entirely, which would give you the following:
If by chance you were trying to use this grammar to specify dtmf-only input, then you can use the <property> tag and specify the inputmodes value as dtmf. This will allow the user to only enter dtmf input, if that's what you would like. Otherwise, the user will be able to enter either dtmf or voice input by default.
Here's how you would specify dtmf-only input using the property tag:
Hope that helps!
Regards,
Plum Support
The issue is with having an unnecessary <grammar> tag. By specifying <field name="userinput" type="digits?length=4">, you've already specified that you will only accept 4 digits from the user. Therefore, you can leave out the grammar tag entirely, which would give you the following:
Code: Select all
<vxml version="2.0" >
<form id="frmTransferGetAmount">
<property name="termmaxdigits" value="false"/>
<field name="userinput" type="digits?length=4">
<prompt> please enter four digits </prompt>
<filled>
<prompt> the number is <say-as type="acronym"> <value expr="userinput"/> </say-as>
</prompt>
</filled>
<nomatch>
<prompt> you should enter only four digits. </prompt>
<reprompt/>
</nomatch>
<noinput>
<prompt>you are entered any input.</prompt>
<reprompt/>
</noinput>
</field>
</form>
</vxml>
Here's how you would specify dtmf-only input using the property tag:
Code: Select all
<property name="inputmodes" value="dtmf"/>
Regards,
Plum Support
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com