It converts the input
parameter to a string if it is an object. Then it checks if there is a pipe character in
the string. If there is, it will split the string at the pipe. It validates the pos argument
next, returning the item at that position if valid, and the last element if invalid. If no
conditions are matched, it returns the string version of the input phrase.
Chapter 9
[ 177 ]
The VXML code is quite similar to what we have seen so far, except the assignment
of value to the application variable. We call the JavaScript function with the
interpretation of the crust field, and pass 0 or 1, telling the function to return the
first or second value. The prompt after that confirms the values set in the
application variables.
Selecting the Topping and Quantity
Selecting the topping and quantity can be done just like selecting pizzas. For
toppings, we have mushroom and olive available. A simple
rule will
suffice here. For quantities, the value can range from 1 to 9. We can recognize and
handle them like this: - one ]]>
.
We are not going to cover toppings and quantity here to save space.
Pages:
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238