title: Validating a phone number in Javascript using Java example as a base
body: <p>Currently i am validating the validation form for phone number using the following code in Java action, but i want to do this validation from javascript, can you guys please guide me.</p>
  
  <pre><code>String mvrUserPhone = mvrUser.getPhone();
          mvrUserPhone = mvrUserPhone.replaceAll("[+-]", "");
          if (!mvrUserPhone.isEmpty()) {
              try {
                  long phoneNumber = Long.parseLong(mvrUserPhone);
                  System.out.println(phoneNumber);
              } catch (Exception ex) {
                  errorMessage = errorMessage + "&lt;br /&gt;- Invalid phone number.&lt;br /&gt; 
  (Please enter phone number in xxx-xxx-xxxx format)";
                  errorCount++;
              }
  </code></pre>
  
  <p>--
  thanks</p>