Creating Your Own Custom WebRTC Form

  1. Home
  2. Programmable Voice
  3. WebRTC
  4. Creating Your Own Custom WebRTC Form

Creating Your Own Custom WebRTC Form

This form requires 2 variables that can be sent via the get method, which are: phone, and account. ext is an optional get variable.

Code for Sample HTML Form

A sample HTML form would look like this:

  <form method="get" action="">
      <input type="text" id="phone" name="phone" />
      <input type="text" id="ext" name="ext" />
      <input type="hidden" id="account" name="account" value="100" />
      <input type="submit" id="submit" value="submit" />

NOTE: The client’s web designer should replace the value 100 in the hidden field account with the account number that they are given.

Additional Notes:

The web designer should verify that only numbers are passed in both the phone and ext text boxes to avoid potential errors.

This can be done via javascript by including the following function in the head section:

     <script type="text/javascript">
     function isNumberKey(evt)
        var charCode = (evt.which) ? evt.which : event.keyCode
        if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
     return true;

And adding the following property to the phone textbox:

  <input id="phone" name="phone" onkeypress="return isNumberKey(event)" />

Server Side Languages

Using a server side language, such as ASP.NET or PHP, the designer could use separate text boxes to make the form more user friendly.

Was this article helpful to you? No Yes 13

How can we help?