Dropdown not working getting blank

Hi am newbie to Fabrik and need some help my drop down is coming up blank

I have two tables. the main table is tbl_object and the reference table for the object type in this table is rft_object_types. rft_object_types is a simple list with no PK. (It's one text column called "ObjectType" it has no id and I do not want one.)

$options[] = JHTML::_('select.option', '0','Please select' );
$db = JFactory::getDbo();
$db->setQuery("SELECT * FROM visiodb_prod.rft_object_types");
$rows = $db -> loadObjectList();
foreach ($rows as $row) {
$options[] = JHTML::_('select.option', $row->text);
}
return $options;
 
I think you must have $row->id in $options[].
Dropdown element have options each with text and value.
Create another column with name id (primary, int, AUTO_INCREMENT).
Then add $row_id like in dropdown element example.
 
"getting blank": set Joomla's error reporting to max to get error messages.

Tooltip in Eval populate says
"PHP Code to create options, should return an array of JHTML select.options. Example: $db = JFactory::getDbo(); $db->setQuery('SELECT id, text FROM #__tablename'); $rows = $db->loadObjectList(); foreach ($rows as $row) { $options[] = JHTML::_('select.option', $row->id, $row->text); } return $options;
I didn't test, maybe it's working if you use your text twice
$options[] = JHTML::_('select.option', $row->text, $row->text);
 
have two tables. the main table is tbl_object and the reference table for the object type in this table is rft_object_types. rft_object_types is a simple list with no PK. (It's one text column called "ObjectType" it has no id and I do not want one.)

I can absolutely 100% guarantee you will run into issues down the road if you don't use an id / PK field. MySQL is a relational database, and Fabrik / Joomla use it as a relational database. Relation databases use primary and foreign keys to operate.

Just give your lookup list / table a numeric, auto-incrementing PK and use that as the 'value' in a join element.

Just trust me on this one. Seriously.

-- hugh
 
I am unable to give it a an id. The data is actually used else where in another application (Visio). Visio can only deal with a flat table structure. The PK is the text.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top