Tag Archives: xform

Xform field validation using regular expression

xform regular expression for validation

Title Expression Example
US phone validation      /^\(?(\d{3})\)?[-\. ]?(\d{3})[-\. ]?(\d{4})$/ 555-555-1212, (555)-555-1212), 555 555 1212, 555.555.1212, (555).555.1212
UK Phone Validation  /^(\+44\s?7\d{3}|\(?\d{5}\)?)\s?\d{3}\s?\d{3}$/ 07222 555555, (07222) 555555, +44 7222 555 555
ZIP code validation    /^[0-9]{10}$/
UK postal validation    /[A-Z]{1,2}[0-9][0-9A-Z]?\s?[0-9][A-Z]{2}/i
Image Validation   /image\/jpeg|image\/png|image\/gif|image\/jpg/  jpg, png and gif
PDF file validation  /application\/pdf|application\/x-pdf/
Alphabet String Length   /^[a-zA-Z]{3,7}$/   Min length 3 and max length is 7
Any String Length   /^.{5,20}$/   Min length 5 and max length is 20

how to overwrite default contact us form by xform’s form?

You will have to do following steps if you want to overwrite default contact form by a form created by xform.

  1. Please navigate to X-Form and click the Cog icon of the form you want to overwrite with.

2.  Now click the ShortCode tab and copy the iframe URL of the form

3.  Now navigates into Extension-> Modules. Install the HTML Content module if it is not yet installed. Now Click the Edit button of the HTML Content module.

4. On the Editor, please CodeView icon

5. Now add following code i.e an frame and some css so it can make hidden default form. Please adjust height of the iframe accordingly. Also don’t forget to update  form URL that you copied earlier. Now click Save button to save the HTML content module.

3. Now navigate to Design -> Layout , Now edit Contact Layout. Finally add HTML content module to the Content bottom position.

That’s all.