else {
$attributes .= 'rows=4';
}
-
if ($field->note_columns) {
$attributes .= ' cols=' . $field->note_columns;
}
else {
$attributes .= ' cols=60';
}
+ if ($field->text_length) {
+ $attributes .= ' maxlength=' . $field->text_length;
+ }
$element = &$qf->add(strtolower($field->html_type),
$elementName,
$label,
break;
case 'RichTextEditor':
- $qf->addWysiwyg($elementName, $label, array('rows' => $field->note_rows, 'cols' => $field->note_columns), $search);
+ $attributes = array('rows' => $field->note_rows, 'cols' => $field->note_columns);
+ if ($field->text_length) {
+ $attributes['maxlength'] = $field->text_length;
+ }
+ $qf->addWysiwyg($elementName, $label, $attributes, $search);
break;
case 'Autocomplete-Select':
if ($this->_id) {
$params = array('id' => $this->_id);
CRM_Core_BAO_CustomField::retrieve($params, $this->_values);
+ // note_length is an alias for the text_length field
+ $this->_values['note_length'] = CRM_Utils_Array::value('text_length', $this->_values);
}
if (self::$_dataToLabels == NULL) {
$attributes['note_rows'],
FALSE
);
+ $this->add('text',
+ 'note_length',
+ ts('Maximum length') . ' ',
+ $attributes['text_length'], // note_length is an alias for the text-length field
+ FALSE
+ );
$this->addRule('note_columns', ts('Value should be a positive number'), 'positiveInteger');
$this->addRule('note_rows', ts('Value should be a positive number'), 'positiveInteger');
+ $this->addRule('note_length', ts('Value should be a positive number'), 'positiveInteger');
// weight
$this->add('text', 'weight', ts('Order'),
}
}
+ // The text_length attribute for Memo fields is in a different input as there
+ // are different label, help text and default value than for other type fields
+ if ($params['data_type'] == "Memo") {
+ $params['text_length'] = $params['note_length'];
+ }
+
// need the FKEY - custom group id
$params['custom_group_id'] = $this->_gid;
INSERT INTO civicrm_mailing_bounce_pattern (bounce_type_id, pattern)
VALUES (@bounceTypeID, 'X-HmXmrOriginalRecipient');
+-- CRM-12716
+UPDATE civicrm_custom_field SET text_length = NULL WHERE html_type = 'TextArea' AND text_length = 255;
if ( data_type_id == 4 ) {
cj("#noteColumns").show();
cj("#noteRows").show();
+ cj("#noteLength").show();
} else {
cj("#noteColumns").hide();
cj("#noteRows").hide();
+ cj("#noteLength").hide();
}
if ( data_type_id > 3) {
<td class="label">{$form.note_columns.label}</td>
<td class="html-adjust">{$form.note_columns.html}</td>
</tr>
+ <tr class="crm-custom-field-form-block-note_length" id="noteLength" {if $action neq 2 && ($form.data_type.value.0.0 != 4)}class="hide-block"{/if}>
+ <td class="label">{$form.note_length.label}</td>
+ <td class="html-adjust">{$form.note_length.html} <span class="description">{ts}Leave blank for unlimited. This limit is not implemented by all browsers and rich text editors.{/ts}</span></td>
+ </tr>
<tr class="crm-custom-field-form-block-weight" >
<td class="label">{$form.weight.label}</td>
<td>{$form.weight.html|crmAddClass:two}