81 Posts
3 years ago


I open a search and list form from the parent-list passing the parent-title. Its nice to see the parents title on the child-list.

I exclude the parent-title-field from the search-query so it doesn't affect the query results. However if I click on the "reset & search"-button the parent-title-field gets cleared...

Is there a way to exclude this parent-title-field from resetting or a way to get the parent-title-value back in it after the reset (the "reset & search"-button affects the URL in such way that it's also not available in the URL anymore....it clears the URL-variables...)

Any ideas are welcome.

Get a Book for SEBLOD
81 Posts
3 years ago
Level 1

One way to fix it (although I guess it is some overhead to just show a parent-title by retrieving it from DB....), is to use before-render and fetch the parent-title form the DB with the parent-ID. Following code does this exactly, if someone knows a more elegant way? Be my guest...

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->where($db->quoteName('id')." = ". $fields['td_parentid']->value);

// Reset the query using our newly populated query object.
$row = $db->loadObjectList(); 

// set form field value (this is a 'free-field')
$fields['tdtrajecttitle']->form = $row['0']->title;

Get a VIP membership