Merge pull request #5883 from mallezie/addfield-website
authorEileen McNaughton <eileen@mcnaughty.com>
Sun, 24 May 2015 11:29:01 +0000 (23:29 +1200)
committerEileen McNaughton <eileen@mcnaughty.com>
Sun, 24 May 2015 11:29:01 +0000 (23:29 +1200)
CRM-16178 use addfield in website form

CRM/Contact/Form/Edit/Website.php

index ffa3244fa4a186e2b8da8e952b03bd84319cabd5..faf7c292c62fb764466a15a7ab191eebd28d49eb 100644 (file)
@@ -59,18 +59,13 @@ class CRM_Contact_Form_Edit_Website {
     $form->applyFilter('__ALL__', 'trim');
 
     //Website type select
-    $form->addSelect("website[$blockId][website_type_id]", array('entity' => 'website', 'class' => 'eight'));
-
+    $form->addField("website[$blockId][website_type_id]", array('entity' => 'website', 'class' => 'eight'));
     //Website box
-    $form->addElement('text', "website[$blockId][url]", ts('Website'),
-      array_merge(
-        CRM_Core_DAO::getAttribute('CRM_Core_DAO_Website', 'url'),
-        array(
-          'onfocus' => "if (!this.value) {  this.value='http://';} else return false",
-          'onblur' => "if ( this.value == 'http://') {  this.value='';} else return false",
-        )
-      )
-    );
+    $form->addField("website[$blockId][url]", array(
+      'entity' => 'website',
+      'onfocus' => "if (!this.value) {  this.value='http://';} else return false",
+      'onblur' => "if ( this.value == 'http://') {  this.value='';} else return false",
+      ));
 
     $form->addRule("website[$blockId][url]", ts('Enter a valid web location beginning with \'http://\' or \'https://\'. EXAMPLE: http://www.mysite.org/'), 'url');
   }