datebasejoin element according id passed via url (default?)

tanya2015

Member
Hello,
I have problem with default value of element. I have list php button to add data from file. I pass row id via url and open te form (see jpg). (I can't do related list because I've alredy has one, user must have clear choice).
date is a databasejoin (date with time I see in dropdown). I need that always first element database join was date according id from url. Now it's Please Select.

Code:
$dateid = $_GET["zayavky___ex_date_raw"];
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('exdate'))->from($db->quoteName('groups'))->where($db->quoteName('id')." = ".$db->quote($dateid));
$db->setQuery($query);
$ex_date = $db->loadResult(); /here I got date according id/
 if (!empty($ex_date))
  {$options[] = JHTML::_('select.option', $value = $dateid, $text = $ex_date, 'value', 'text', $disable=true);
   return $options[];
}
Yes, i understood I make something wrong in $option... this is not string.... But don't have idea
using code above I've always got error
Warning: strpos() expects parameter 1 to be string, object given in C:\OSPanel\domains\aes.local\libraries\src\Language\Text.php on line 98

Warning: explode() expects parameter 2 to be string, object given in C:\OSPanel\domains\aes.local\libraries\src\Language\Text.php on line 104

Warning: Invalid argument supplied for foreach() in C:\OSPanel\domains\aes.local\libraries\src\Language\Text.php on line 107

Warning: array_shift() expects parameter 1 to be array, null given in C:\OSPanel\domains\aes.local\libraries\src\Language\Text.php on line 112

Warning: strtoupper() expects parameter 1 to be string, object given in C:\OSPanel\domains\aes.local\libraries\src\Language\Language.php on line 314

Warning: strpos() expects parameter 1 to be string, object given in C:\OSPanel\domains\aes.local\libraries\src\Language\Language.php on line 361

Catchable fatal error: Object of class stdClass could not be converted to string in C:\OSPanel\domains\aes.local\libraries\src\Language\Language.php on line 364

Thank you for any idea.
 

Attachments

  • 21.jpg
    21.jpg
    23.5 KB · Views: 63
Hi, instead of $options...just write:

Code:
return $date_id;

If you set the value of databasejoin element, corresponding label (set in databasejoin element settings) is displayed in the dropdown.
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top