cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2244
Views
0
Helpful
21
Replies

Custom Java class to validate the date that entered by user

vincent.zheng
Level 4
Level 4

Current I have a CustomDateWithConfirm class which is extend to MBasicDateWithConfirm, to valid the date such as "19900231", the way currently I did is once I get this value, I increment the disconfirmed count, then ask the user to re-enter the date again. The way I want is if user the invalid date, such as 19900231, I  need the way to let CVP know it is Date NoMatch state, and ask user to re-enter again, how can I do this?


By the way I using CVP 10.5

21 Replies 21

Can you give me an code snippet for using VAction to throw nomatch event?

vincent.zheng
Level 4
Level 4

So seems like no way to do in Java code?

janinegraves
Spotlight
Spotlight

I don't really understand what you're looking for.

You said that you'd created your own DateWithConfirm element, so you must know how to write a voice element using java and the java classes that create the associated vxml tags. So, all you need to do is within the <filled> tag, use a VAction to throw an noinput event. I've never done this using Java, so no, I can't give you the java to do this.

Personally, I wouldn't use the DateWithConfirm.

I would use a Digits element to ask the caller to enter an 8-digit date.

Then in the Studio app, I'd check if it was a valid date (using a custom java element or the new SetValue element with javascript).

If not valid, I'd increment a counter, check the counter, and if it's less than some value (like 3), I'd tell the caller they entered an invalid date, and loop back to re-collect.

If it's valid, then I'd connect to a YesNoMenu to confirm.

While it's more steps in Studio, it's easy to follow and easy to maintain.

Janine

OK, let us bring the question simple.

For all the element(let's say the simplest one, digit) that already implement by call studio, how do they know the input that given by user is no match? I am reading the source code for that, but I can't find any code related information in the source. If I know where the code handle this, that simply answer the original questions..

When you use the Digits element in Studio, you configure the MinDigits

and MaxDigits allowed under Settings.

If the caller enters anything less than the MinDigits, or if the caller

enters the DTMF * key (which is not a 'digit') then the system throws a

NoMatch event. And then based upon the Setting named MaxNoMatch - it'll

either reprompt the caller or return to VXML Server to continue down the

max_nomatch exit state.

Most of the Studio elements that collect input, are loading up a

built-in grammar on the gateway. The allowable inputs for each element

corresponds to the allowable input for the associated grammars (Digits,

Number, Currency, Date, Time, Phone).

You can look in the CVP Documentation at the Element Specifications

reference manual, it should tell you want the different elements accept

from the caller.

You can also look in the VXML 2.0 Specification as it'll tell you what

the VXML builtin grammars accept and what they return.

vincent.zheng
Level 4
Level 4

I look at the VXML format, I understand that part.. However, there is no way to convert back to java code. (All the Cisco element are implemented by Java in elements.jar). And I even try to re-write the whole element line by line, and no luck for that.. so I give up this approach. Thanks for help anyway.