$form->addElement('text', 'job_title', ts('Job Title'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'job_title'));
//added internal ID
- $form->addElement('text', 'contact_id', ts('Contact ID'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'id'));
+ $form->add('number', 'contact_id', ts('Contact ID'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'id') + array('min' => 1));
$form->addRule('contact_id', ts('Please enter valid Contact ID'), 'positiveInteger');
//added external ID
$type, $name, $label = '',
$attributes = '', $required = FALSE, $extra = NULL
) {
- if ($type == 'wysiwyg') {
+ // Fudge some extra types that quickform doesn't support
+ if ($type == 'wysiwyg' || $type == 'number') {
$attributes = ($attributes ? $attributes : array()) + array('class' => '');
- $attributes['class'] .= ' crm-form-wysiwyg';
- $type = "textarea";
+ $attributes['class'] = ltrim($attributes['class'] . " crm-form-$type");
+ $type = $type == 'wysiwyg' ? 'textarea' : 'text';
}
// @see http://wiki.civicrm.org/confluence/display/CRMDOC/crmDatepicker
if ($type == 'datepicker') {
elseif (strpos($class, 'crm-form-contact-reference') !== FALSE) {
self::preprocessContactReference($element);
}
+ // Hack to support number fields
+ elseif (strpos($class, 'crm-form-number') !== FALSE) {
+ $element->setAttribute('type', 'number');
+ }
if ($required) {
$class .= ' required';