Advanced Fields
August 17, 2012
Form Layout
August 17, 2012

Custom Field Validation

Field Validation allows you to accept only the data that meets your required format. You can choose from predefined validation types or create custom validation codes. The predefined types are:

  • alpha – only letters
  • alphanumeric – letters and digits
  • alphaspace – letters and white spaces
  • alphanumericspace – letters, digits and white spaces
  • numeric – only digits
  • numericplus – digits and the characters +, -, .
  • email – email addresses
  • URL (webpage) – webpage URLs (e.g. http://123contactform.com/docs/)
  • date – YYYYMMDD – date as year/month/day
  • date – DDMMYYYY – date as day/month/year
  • date – MMDDYYYY – date as month/day year
  • date – MMDDYYYY + picker – date as month/day/year and a calendar in which users can pick the date instead of typing it in
  • date – DDMMYYYY + picker – date as day/month/year and a calendar in which users can pick the date instead of typing it in
  • date – MMYYYY – date as month/year
  • time – time coordinates (hours and minutes)
  • custom

You can change the validation for a form field only if you are on a Gold plan or higher.

With custom validation, you can define your own validation code. Choose Custom in the validation dropdown list and type your code in the box that shows up. The code will have a format such as CCCCNNAAAAAANN. The code letters that you may use are:

  • C – character (letter)
  • N – numeric (digit)
  • A – alphanumeric (letter or digit)
  • L – lowercase letter
  • U – uppercase letter
  • S – white space

You can also use other types of validation, for example: REGEXP:/^(?:\+?1[-. ]?)?\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/, which is the international phone number format. In this case, select Custom in the Field Validation dropdown list and paste the code above in the input box.

If your form requires even more complex field validation, contact us and we’ll help you get it done.

28 Comments

  1. Jill says:

    Could you send a format for a SSN with dashes?

    • Hello Jill!
      To hide the information that is typed in the field behind dashed, may I suggest you add a Password field to the form and rename it to SSN. But be careful not to use the field before or after an email field, for safety reasons. If you require further assistance, don’t hesitate to contact us at support[at]123contactform.com
      Thanks!

  2. Talal AlRefaai says:

    hi, i want a validation for a phone number this exact way:
    971559945971

    this means 12 numeric digits, NO spaces, no dash, no plus

    can u please help?

    • Hello Talal!

      I apologize for replying this late. Customer support service goes faster if you contact us via our contact page or use the live chat window, when it appears on our platform during working hours. Now regarding your inquiry.

      Add a Number field to your form and make sure it uses the numeric validation. Next, go to the additional settings of the field, located on the second tab. Use the boxes to set the minimum and maximum length of the accepted input to 12, which is the number of digits (or characters) the phone number you provided in the example. Once you’ve done this, form users will not be able to submit the form unless they provide their phone number in the correct format.

      I hope this helped. For more assistance, don’t hesitate to contact our support specialists.

      Thanks!

  3. Russ B. says:

    I need to create a password reset request form. Our pass word requirement AlphaNumeric with at least 1 capital letter and at least one special character ie. !.@# etc. Can be in any order… I don’t see anything that would quite accomplish that…

    Thanks for any assistance.

    Russ

    • Manu says:

      Hi Russ!

      I’m sorry but at this time we don’t have one that lets you randomly add a word that fits that description.

      You can create a custom field that will request those characters, but your users would have to create their password in the exact order you specify, which doesn’t leave much room for them to come up with a secure or original password.

  4. food trolley price says:

    I’m not sure why but this web site is loading incredibly
    slow for me. Is anyone else having this problem or is it a
    problem on my end? I’ll check back later and see if the problem still exists.

  5. Tony says:

    How can I set the validation for phone numbers?

  6. Mike says:

    I have a custom field validation in my form that must be an exact 4 digit number to submit (essentially a code). If someone enters the incorrect numbers, the error message reads “Expected input: custom” Is there a way to change that to make it make more sense to the visitor? I’d like it to possibly read “Invalid code” or something to that effect.

    • Hello Mike!

      To change the text of the error message, go to Form SettingsTranslations section of your form and hit the Add Language button. Select English and hit Done. Next, hover over the added language until you see the Customize button on the right. Click Customize and scroll down to System Messages, within the lightbox. In System Messages, look for the line Expected input and type “Invalid code” in the input box on the right. Afterwards, scroll down until you see the line custom and change it to “ ” (which will add a space instead of the text “custom”).

      Press Save to exit the lightbox and you are done.

      For further assistance, don’t hesitate to contact our Support Team at support@123contactform.com or via our contact form.

      Thanks!

  7. Mark says:

    Hi, We have a contact form that we have set up for our field team, and i need to get the first letter of certain fields capitalised, however the data to be entered can be of variable lengths so i cannot use a standard custom field validation method as it would force the exact amount of characters to be entered.

    All i need is for the first letter to be a capital, but then for it to allow a variable amount of text afterwards such as the first entry being John and the next being Timothy etc.

    Can anyone help please?

    Thanks

  8. Jielaan Khlaaf says:

    Is it possible to add on a geographic location drop down on the form?

  9. Esther says:

    I have created a quote page on my website, and utilized your 123contactform. There is a field called Food Budget for this Event. I want to know how I can allow users to enter a comma, dollar sign, and period in this field i.e. $1,000.00

  10. Simon Salt says:

    I want to have my visitors enter their web address but I do not want the validation to fail because of the missing “http://” how do I achieve that?

    • Hello Simon!

      You could add a textbox field to your form, set it on URL for the validation and type in the text “http://” inside the Default Value box. Whenever the form visitors access your form, they can click on the input of the field and complete it with their website.

      For further assistance, don’t hesitate to contact our Support Team at support@123contactform.com or via our contact form.

      Thanks!

  11. jason says:

    How can I use custom validation to enforce a negative number. For example I want a user to input -100. If they enter “100”, it should not allow it.

    • Hello!

      We do not support custom validation for negative numbers only, but what you can do is use field rules and hide the submit the button if the input is bigger than -1. You can also use field instructions to inform your form visitors that only negative numbers are permitted in the field. Here are the steps:

      1. In My Forms, select your form and go to Settings.

      2. In Settings, go to RulesField Rules.

      3. Hit Add Rule and set this condition: If name of your field is greater than -1 then hide Submit Button.

      How does this work: if the person who fills out the form types in the field the value 0, for example, the submit button will disappear and the form can not be submitted. But if the person types in -1, the submit button will reappear. The same for -2, the submit button will still be present. But if the person types in 1, 2 or 100, the submit button will disappear again.

      In the Form Editor you can add Instructions to your field, to inform your form users of the input required in the field.

      For further assistance, don’t hesitate to contact our Support Team at support@123contactform.com or via our contact form.

      Thanks!

  12. fattah says:

    Hello,
    How can i change the text-box to all user insert words and automatic the system change in UPPERCASE ?
    Thank you

    • Hello!

      We haven’t got the option to automatically change form inputs in Uppercase. You can, however, use a JavaScript code that contains this functionality and link it to your form. If you upgrade to the Platinum plan, you can use the WebHooks integration that applies these changes on your server through a script. The script and server, however, are provided by you.

      Our available plans: http://www.123contactform.com/features-matrix.html

      What you can do to prevent form users from adding form inputs in Lowercase is to add a custom field validation to your textboxes. Select custom under field validation and add the value U. Form users will not be able to submit the form unless they type their input in Uppercase. If you upgrade to Gold, you can use Translations to change the system message from Expected input: custom to any text you want, such as Expected input: Uppercase letters.

      For more questions or assistance, please contact our Support Team at support@123contactform.com and they will gladly help.

      Thanks!

  13. Moti says:

    Hello,
    How can i change the validation error message to my own message?

    • Hello!

      To change error messages on your form, simply go to the Form SettingsTranslations section, add a default language (e.g. english) and hit Customize (hover mouse over the line to see the button). In the lightbox, go to System Messages to translate/change error messages that your form users might see. You don’t need to enable translations on your form. Read more here.

      For questions or assistance, don’t hesitate to contact our Support Team at support@123contactform.com

      Thanks!

  14. John Perescott says:

    I want to change the input value of a date to month/year but I can’t fine the ‘custom validation’ drop down menu on my forms? Where so I find it? Thanks, John

    • Hello John!

      To change the input value to month/year , you’ll need to add a Textbox field to your form, instead of the Date field. Drag and drop the Textbox on your form and go to Field Validation from the Edit Field panel. Once there, select date-MMYYYY from the dropdown list. Remember to include a field instruction for your form visitors to add ‘/’ between the month and the year, otherwise they will not be able to submit the form.

      For more questions or assistance, please don’t hesitate to contact our support specialists at support@123contactform.com

      Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *