I was going through this part of the tutorial:
https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Using_the_database
Except I tried using my own names instead of 'helloworld'.
Everything else works fine, even the site-page loads the text from the database. The problem is:
On the backend 'Menu Item' options, where there's supposed to be a list, it's just showing a blank textbox.
The codes I've used are:
site/views/uploadwizard/tmpl/default.xml
:
<metadata>
<layout title="COM_OMITTED_UPLOADWIZARD_VIEW_DEFAULT_TITLE">
<message>COM_OMITTED_UPLOADWIZARD_VIEW_DEFAULT_DESC</message>
</layout>
<fields
name="request"
addfieldpath="/administrator/components/com_omitted/models/fields"
>
<fieldset name="request">
<field
name="id"
type="ulwiz_wmode"
label="COM_OMITTED_UPLOADWIZARD_FIELD_WMODE_LABEL"
description="COM_OMITTED_UPLOADWIZARD_FIELD_WMODE_DESC"
/>
</fieldset>
</fields>
</metadata>
admin/models/fields/ulwiz_wmode.php
:
<?php
defined('_JEXEC') or die('Restricted access');
JFormHelper::loadFieldClass('list');
class JFormFieldUlWiz_WMode extends JFormFieldList
{
protected function getOptions()
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('id,wmode');
$query->from('#__omitted_ulwiz_wmode');
$db->setQuery((string) $query);
$messages = $db->loadObjectList();
$options = array();
if ($messages)
{
foreach ($messages as $message)
{
$options[] = JHtml::_('select.option', $message->id, $message->wmode);
}
}
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}
And the Database description:
DROP TABLE IF EXISTS `#__omitted_ulwiz_wmode`;
CREATE TABLE `#__omitted_ulwiz_wmode` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`wmode` VARCHAR(25) NOT NULL,
`published` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
)
ENGINE =MyISAM
AUTO_INCREMENT =0
DEFAULT CHARSET =utf8;
INSERT INTO `#__omitted_ulwiz_wmode` (`wmode`) VALUES
('Option1Text'),
('Option2Text');
How do I fix this? I've been at it for hours and am unable to move over to the next part of the tutorial hence.