Page 1 of 1

verifying a field on a form

Posted: Mon Aug 16, 2010 3:49 pm
by neilstebbing
I was trying to verify a field all on the one form. So i wanted the user to enter/say Field1 and then i wanted to repeat the value of field1 back to the user and get them to verify by e.g. 1 to continue of * to reenter (reprompt)...So i am having trouble doing this all on the one form. So it seems i will have to do this on multiple forms but this does not seem good design. Can i do this on one form or is multiple forms my only option? :D

Re: verifying a field on a form

Posted: Tue Aug 17, 2010 8:06 am
by support
Hi Neil,

You can actually do this all in one form. The following is a short example of how you would accomplish this using only a single form:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
  <form id="start">
    <field name="myfield" type="digits?length=1">
      <prompt>
        Say or enter a digit.
      </prompt>
      <filled>
        You entered <value expr="myfield"/>.
      </filled>
    </field>
    <field name="confirm">
      <grammar type="application/x-jsgf" mode="dtmf">
        ( 1 | 2 )+
      </grammar>
      <prompt>
        Is this correct? Press 1 for yes or 2 for no.
      </prompt>
      <filled>
        <if cond="confirm==1">
          <prompt>
            Ok. All done.
          </prompt>
        <else/>
          <goto next="#start"/>
        </if>
      </filled>
    </field>
  </form>
</vxml>
Regards,
Plum Support

Re: verifying a field on a form

Posted: Mon Aug 01, 2011 12:46 am
by IanM
Just wanted to say thanks @support, this helped me as well. This answer came up right away on the forum search.