Public Member Functions | |
render (Varien_Data_Form_Element_Abstract $element) |
Definition at line 32 of file Region.php.
render | ( | Varien_Data_Form_Element_Abstract $ | element | ) |
Implements Varien_Data_Form_Element_Renderer_Interface.
Definition at line 35 of file Region.php.
00036 { 00037 if ($country = $element->getForm()->getElement('country_id')) { 00038 $countryId = $country->getValue(); 00039 } 00040 else { 00041 return $element->getDefaultHtml(); 00042 } 00043 00044 $regionId = $element->getForm()->getElement('region_id')->getValue(); 00045 00046 $html = '<tr>'; 00047 $element->setClass('input-text'); 00048 $html.= '<td class="label">'.$element->getLabelHtml().'</td><td class="value">'; 00049 $html.= $element->getElementHtml(); 00050 00051 $selectName = str_replace('region', 'region_id', $element->getName()); 00052 $selectId = $element->getHtmlId().'_id'; 00053 $html.= '<select id="'.$selectId.'" name="'.$selectName.'" class="select required-entry" style="display:none">'; 00054 $html.= '<option value="">'.Mage::helper('customer')->__('Please select').'</option>'; 00055 $html.= '</select>'; 00056 $html.= '<script type="text/javascript"> 00057 if ($("'.$country->getHtmlId().'") != undefined) { 00058 new regionUpdater("'.$country->getHtmlId().'", "'.$element->getHtmlId().'", "'.$selectId.'", '.$this->helper('directory')->getRegionJson().'); 00059 } 00060 </script>'; 00061 $html.= '</td></tr>'."\n"; 00062 return $html; 00063 }