From: sunil Date: Tue, 31 May 2016 06:27:14 +0000 (+0530) Subject: CRM-10230 Custom fields text type with limited length not validated X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a6e63388def438d2b4b8c72aee1bbedc97890e1c;p=civicrm-core.git CRM-10230 Custom fields text type with limited length not validated --- 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