Do you know how I can make the phone number required 10 digits? If possible I want the visitor to be able to only enter 10 digits in the phone number field or the form cannot be submitted.

It definitely is possible to require the phone number field to be ten digits. Here is how to do it:

  • Go to your form, and then to the text element that you are using for your Telephone field. 
  • To work for this example, it would be best if you give the element the name "telephone" (without quotes) in the field underneath the "Label" field.
  • Put a checkmark in the Validation box, and then click on the radio button to the right of the word 'Custom' in the next line.
  • Enter an error message (for example: "Please enter a valid 10-digit number without dashes, periods, or brackets").
  • Click on "Create code framework." (It doesn't look like a link, but it is!)
  • A javascript popup will appear which says: "Create code framework for validation now?
  • (Existing code will be appended)." Click on OK.
  • In the text area that opens, delete all of the code which is currently there, and replace it  with:

 

function ff_telephone_validation(element, message)
{
     if(!isNaN(element.value) && element.value.length == 10)
     {
          return '';
     }
     return 'Please enter a valid number (exactly 10 digits)';
} // ff_telephone_validation

 

  • Click on SAVE PROPERTIES.
  • Click on the SAVE icon in the upper right-hand corner of the screen.
  • Test your form. It should work. :-)

 

 

 

 

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!