From 8c2d93830fbcb1d37f43845da78cb43b696d6b57 Mon Sep 17 00:00:00 2001 From: Tim Mallezie Date: Tue, 24 Mar 2015 21:32:18 +0100 Subject: [PATCH] Add correct attributes for textfields, remove unnecessary attributes from html element, disable select date and textarea --- CRM/Contact/Form/Edit/Individual.php | 11 +++++------ CRM/Core/Form.php | 19 ++++++------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/CRM/Contact/Form/Edit/Individual.php b/CRM/Contact/Form/Edit/Individual.php index bc13a3843a..1d48c79bab 100644 --- a/CRM/Contact/Form/Edit/Individual.php +++ b/CRM/Contact/Form/Edit/Individual.php @@ -70,22 +70,22 @@ class CRM_Contact_Form_Edit_Individual { $attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact'); if (isset($nameFields['Formal Title'])) { - $form->addField('formal_title'); + $form->addField('formal_title', $attributes['formal_title']); } // first_name if (isset($nameFields['First Name'])) { - $form->addField('first_name'); + $form->addField('first_name', $attributes['first_name']); } //middle_name if (isset($nameFields['Middle Name'])) { - $form->addField('middle_name'); + $form->addField('middle_name', $attributes['middle_name']); } // last_name if (isset($nameFields['Last Name'])) { - $form->addField('last_name'); + $form->addField('last_name', $attributes['last_name']); } // suffix @@ -104,8 +104,7 @@ class CRM_Contact_Form_Edit_Individual { // job title // override the size for UI to look better $attributes['job_title']['size'] = 30; - //$form->addElement('text', 'job_title', ts('Job Title'), $attributes['job_title'], 'size="30"'); - $form->addField('job_title', array('size' => 30)); + $form->addField('job_title', array('size' => '30') + $attributes['job_title']); //Current Employer Element $props = array( 'api' => array('params' => array('contact_type' => 'Organization')), diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 728ee69943..967c30154e 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1214,25 +1214,18 @@ class CRM_Core_Form extends HTML_QuickForm_Page { } } + CRM_Utils_Array::remove($props, 'entity', 'field', 'context', 'label'); switch ($widget) { case 'Text': case 'Link': //TODO: Autodetect ranges - $this->add('text', $name, $label, NULL, $required, $props); + $this->addElement('text', $name, $label, $props, $required); break; - case 'TextArea': - //Set default rows and cols - $props['rows'] = isset($props['rows']) ? $props['rows'] : 4; - $props['cols'] = isset($props['cols']) ? $props['cols'] : 60; - $this->add('textarea', $name, $label, NULL, $required, $props); - break; - - case 'Select Date': - //TODO: Add date formats - //TODO: Add javascript template for dates. - $this->addDate($name, $label, $required); - break; + //case 'TextArea': + //case 'Select Date': + //TODO: Add date formats + //TODO: Add javascript template for dates. // case 'Radio': case 'Select': -- 2.25.1