Solved Calc element problem - shows in form view but breaks list view

chrisyork

Member
I am going round in circles with a calc element.

I have a radio button {repeat___Level} that contains basic, intermediate, advanced, so a user selects which level they want and the calc then shows an 'underlying value' of what is meant by that selection. There are reasons that I don't want to just use the underlying text within the radio button.

It works perfectly in form view. But as soon as I publish it, the list view for hat form breaks and I get page not found
Code:
0 syntax error, unexpected token ")"
. This occurs even if the element is not shown in list view. I have got a workaround to exclude it from the list query, but in reality the purpose of this element is to show in list... so that's not technically a workaround, just just allows the list to load!

I have tried setting the system error reporting to maximum and fabrikdebug=1 on the list page, but I can't get any further information about what the error actually represents - it just breaks.

Here is the php, which is Ajax on the radio button element:

Code:
$db = \Joomla\CMS\Factory::getContainer()->get('DatabaseDriver');
// Create a new query object.
$myQuery = $db->createQuery(true);

$myQuery
    ->select(array('id','basic', 'intermediate','advanced','idea_basic','idea_intermediate','idea_advanced'))
    ->from('table')
    ->where('activity = '. $db->quote('{repeat___themes_raw}'));

// Assign the query to the db
$db->setQuery($myQuery);

// Load the results as an array of objects.
$rows = $db->loadObjectList();
//return $rows;
$list = array();
switch ({repeat___Level_raw}) {
case 1:
foreach ($rows as $row)
{
    $list[] = $row->idea ;
}
break;
case 2:
foreach ($rows as $row)
{
    $list[] = $row->idea_intermediate;
}
break;
case 3:
foreach ($rows as $row)
{
    $list[] = $row->idea_advanced;
}
break;
default:
$list[] = "Not recorded";
}

return implode($list);

I'm using Joomla 5 and haven't found any other differences from Joomla 4 yet, but I hope it's not an incompatibility...

Thanks in advance for any suggestions.
 
Spot on!!!!!

Thank you. Both for the speed of reply and the good advice! I will bear that in mind for future.

VERY much appreciated.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top