From a6e63388def438d2b4b8c72aee1bbedc97890e1c Mon Sep 17 00:00:00 2001 From: sunil Date: Tue, 31 May 2016 11:57:14 +0530 Subject: [PATCH] CRM-10230 Custom fields text type with limited length not validated --- CRM/Core/BAO/CustomField.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index ec67256b03..8d3297f2b5 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -864,6 +864,12 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $qf->add('text', $elementName . '_to', ts('To'), $field->attributes); } else { + if ($field->text_length) { + $field->attributes .= ' maxlength=' . $field->text_length; + if ($field->text_length < 20) { + $field->attributes .= ' size=' . $field->text_length; + } + } $element = $qf->add('text', $elementName, $label, $field->attributes, $useRequired && !$search -- 2.25.1