0

i add a contactno field in helloworld component backend. i add a no. of line code same as a Adding categories.

the files loactions:

  1. admin/sql/install.mysql.utf8.sql... i add a contactno field

  2. admin/models/forms/helloworld.xml... i add a contactno field below greeting field

<field name="contactno" type="text" default="Some text" 
 description="COM_HELLOWORLD_HELLOWORLD_CONTACT_DESC"
label="COM_HELLOWORLD_HELLOWORLD_CONTACT_LABEL" 
size="10" />
  1. admin/models/fields/helloworld.php i add a query in protected function getOptions()
$query->select('#__helloworld.id as id,greeting,#__helloworld.contactno as contactno,#__categories.title as category,catid');   
  1. admin/views/helloworlds/tmpl/default.php...i add a contactno field th in table below author field
<th width="30%">
                <?php echo JHtml::_('searchtools.sort', 'COM_HELLOWORLD_CONTACTNO', 'contactno', $listDirn, $listOrder); ?>
            </th>

and td below author

<td align="center"> <?php echo $row->contactno; ?> </td>

when i run a helloworld component i got error

Notice: Undefined property: stdClass::$contactno in C:\xampp\htdocs\Joomla\administrator\components\com_helloworld\views\helloworlds\tmpl\default.php on line 92

what is my mistake...where define a new field...?

Kishor Admane
  • 59
  • 1
  • 11

1 Answers1

0

i solve by adding in associative array of configuration settings. file location is: admin/models/helloworlds.php i add a new fields contactno in array and updating in query of getListQuery()

 $query->select('a.id as id, a.greeting as greeting, a.contactno as contactno, a.published as published, a.created as created')
Kishor Admane
  • 59
  • 1
  • 11