Is there a way to populate fields from a database table?

In this case, the table that I'm pulling from has the user's Email address in it - this grabs the Email address of the current user and finds that Email in the table I am querying, then populates the field values of the form.

Before Form Piece:


$this->execPieceByName('ff_InitLib'); //Include BreezingForms Library
$db = JFactory::getDBO();//Get Database Object
$user = &JFactory::getUser();//Get user Object

//Create your own query 
$db->setQuery('Select name From #__users Where id='.$user->id); 

$result = $db->loadResult(); //load the result from the query
ff_setValue('ElementName', $result); // populate the value in the form. Change ElementName to the real name of your element


The code above is just a sample on how to set up a database query and set the form values in a before form piece. If you want to populate values from the logged in user, you can do this much more quickly by adding  the following code directly into the value field of a text element (you do not need any Before Form Piece):


<?php $user = &JFactory::getUser();return $user->name;?>


<?php $user = &JFactory::getUser();return $user->email;?>


Note the second code sample does not work for Eaysmode forms. For Easymode please check the following link

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!