/**
  *        This function will return the element as HTML.
  *
  *        @returns        The form element as HTML text.
  */
 function toHtml()
 {
     // Create the list of attributes
     $attribs = array('id' => $this->_form . '_' . $this->_name);
     $attribs = array_merge($this->_attributes, $attribs);
     $template_record = new YDTemplate();
     // set form defaults
     if (isset($this->defaults)) {
         $this->form->setDefaults($this->defaults);
         $template_record->assign('defaults', $this->defaults);
     }
     // get record template and assign recordset
     $template_record->assign('recordset', $this->_value);
     $template_record->assign('columns', $this->columns);
     $template_record->assignForm('form', $this->form);
     // Get the HTML
     return $template_record->fetch(dirname(__FILE__) . '/YDFormElement_Grid.tpl');
 }