I know the documentation says you should leave it the same, but suppose I know I want the text field to be only 3 characters every time?

I can set it fine in custom fields, but when I go to enter data, and a user mistakenly puts in more than 3 characters, it throws a database error. Is there somewhere else besides the custom field specification where I can set up CiviCRM to validate user input?

(note: this can be reproduced on the civicrm demo server)

1 Answer 1


being able to set a length make sense. As you describe, you might want to have the length limited, because it's a zip code, a country code, a whatever you know has a fixed length.

The problem is not on the database definition, but on the user interface, that should prevent being able to put more chars that the field can accept.

Where do you experience the problem? is this in the back-office or using profiles?

Would be awesome if you could correct civicrm core to the check is done at the interface level (don't make the field longer than what the database can store) instead of the ugly error triggered by the database.

(You might want to check on the next version of civi see if you're lucky and that has already been fixed)


  • 1
    The problem happens in both the back-office and profiles. I agree that it is a UI error, I'm just surprised it's there! :)
    – Cheryl
    Commented Dec 10, 2015 at 13:52
  • It throws a civi/mysql exception in civicrm 4.6.20 if data in custom text field exceeds pre-defined value, so, guess, it hasn't been fixed as of Aug 2016
    – yurg
    Commented Aug 7, 2016 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.