Robert Dickey
Robert Dickey

Reputation: 834

vXML if statement (DTFM only)

I have a simple yes or no question being asked in vXML 2.0. I am trying to get the user to be able to press 1 for yes, or two for 2 for no. I have looked up dozens of answers to this question, however, they all mentioned voice input only and not dtfm. I'm sure it is an obvious answer, but I am at a loss.

Here is my code

<form>
<field name="verifyinput" type="digits?minlength=1;maxlength=1">            
 <prompt> You entered <?php echo $_SESSION["accountnumber"]; ?>. . If that is your Account Number Press 1. Otherwise Press 2.  
</prompt>       
<filled>

</filled>
</field>
</form>

I am not sure what to put in the Filled tab.

Upvotes: 1

Views: 376

Answers (1)

Jim Rush
Jim Rush

Reputation: 4163

For simple recognition results, you can just check the value of the field name:

   <form>
      <field name="verifyinput" type="digits?minlength=1;maxlength=1">            
      <prompt> You entered <?php echo $_SESSION["accountnumber"]; ?>. . If that is your Account Number Press 1. Otherwise Press 2.  
      </prompt>       
      <filled>
          <if cond="verifyinput == '1'">
              <!-- executable content -->
              <prompt>You said one</prompt>
          <elseif cond="verifyinput == '2'"/>
              <!-- executable content -->
              <prompt>You said two</prompt>
          <else/>
              <!-- executable content -->
              <prompt>You made an invalid choice</prompt>
          </if>
       </filled>

Upvotes: 2

Related Questions