Element default value

Alphons

New Member
hi, is it possible to use a prefilter value - {$q->agb} see screenshot - as a default element value?
 

Attachments

  • pre-filter.png
    pre-filter.png
    15 KB · Views: 253
  • default_value.png
    default_value.png
    7.7 KB · Views: 266
If you switch Eval to yes you can run any PHP code you wish to present a default value. You may have to run a sql query to get the results you need.
 
hi felixkat, thanks for your answer. I tried it and a simple return works (without reading the DB). When i try this example:

$sql = "SELECT agb FROM zorgverlener where site_users_id = {$my->id}";
$agb = mysql_query( $sql);
return {$agb};

nothing returns to the screen.

Do i think to simple?
 
Try something like...


PHP:
$db = JFactory::getDbo();
 
$query= "SELECT `zorgverlene`.`agb` FROM `zorgverlener` WHERE site_users_id =  {$my->id}";
 
$db->setQuery($query);
 
$result = $db->loadResult();
 
return $result;
 
Hi Felixkat,

i looked in that direction but without good result. I tried your syntax but get an error in the frontend (Error: 0 - SQL=SELECT `zorgverlener`.`agb` FROM `zorgverlener` WHERE site_users_id = 146). The SQL is correct - i tried it in phpmyadmin.

If i skip the last codeline (return $result;) no error displayed but/and the programming syntax is displayed in the frontend.

extra info: The DB with the table 'zorgverlener' is not part of the joomla DB but in a seperated DB
 

Attachments

  • agb.png
    agb.png
    1.3 KB · Views: 223
Ahh okay if it's a different database that won't work then.

You need to add the database into Fabrik->Connections if you haven't done so already.

Replace
PHP:
$db = FabrikWorker::getDbo(false, 2);
instead of JFactory::getDbo. The number "2" reflects the connection ID number. So "2" should be correct if this is your second connection.

At least I think this is correct, it's been a while. :)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top