• Payment Plugins Poll

    We need your feedback on the need for updated payment plugins. Please go here and give us your feedback.

  • Joomla 5.1

    For running J!5.1 you must install Fabrik 4.1
    See also Announcements

  • Subscription and download (Fabrik 4.1 for J!4.2+ and J!5.1) are working now

    See Announcement
    Please post subscription questions and issues here

    We have resolved the issue with the J! updater and this will be fixed in the next release.

  • Update & Changlog URL Fixer

    At the present time the update site URL for Fabrik is incorrect in all installations up to and including 4.1. This will be corrected in 4.2, however, if you wish to update Fabrik via the J! Updater you can download and install this plugin.

    This file is installed just like any other extension through the J! Extension Installation panel. It will not however actually install anything. Its sole purpose is to fix the Update Site and Changlog URL's. Once done it will simply exit.

    As always, we recommend you perform a site backup priot to installation.

pre-check items of form checkbox or picklist


In a From, I have an 'Eval populate' code to populate my checkbox list or picklist.
I would like to pre-check some items.

How can I do ?
I think you should be able to do it already within your eval code (didn't test though).

Just check if checkbox value is "something". If yes, add "checked" attribute to the checkbox element.
@juuser Doesn't eval populate just expect an array (options) for the values? How can an attribut be set for one of the options?
Assuming the OP uses similar code:
$db = JFactory::getDbo();
$db->setQuery('SELECT id, text FROM #__tablename');
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$options[] = JHTML::_('select.option', $row->id, $row->text);
return $options;
I remember that the JHTML accepted third parameter (array) as an argument, like:
$options[] = JHTML::_('select.option', $row->id, $row->text, 'ARGUMENTS ARRAY');
but now that I tested that, it indeed doesn't seem to work.

So @wezetel's suggestion is probably a way to go. Just some generic js/jQuery should do in form_x.js which loops through the checkbox options on "document ready" function and sets the option as checked if the value is "something".
Try assigning the output of the JHTM to a var of $option. The set $option->selected = 'selected'; (might be 1 or true, don't remember off the top of my head), then $options[] = $option, I am going from old memory here but I hope it helps.
Thank's for the answer.
I don't find how to insert the selected option.

part of eval code :

$Db->setQuery("SELECT id,nom FROM table");
$Libs = $Db->loadObjectList();
foreach ($libs as $Lib) {
$options[] = JHTML::_('select.option', $Lib->id, $Lib->nom);
return $options;
I'm sorry but I don't understand what you explain.
Can you tell me what I have to change in my following script ?
In F3, the 'echo' with 'script' toggle the item I want to pre-check.

eval script :

$Db = FabrikWorker::getDbo(false, 2);
$Db->setQuery("SELECT id,name,select FROM name_table WHERE `type`='Y' ORDER BY name");
$Lines = $Db->loadObjectList();
foreach ($lines as $line) {
$options[] = JHTML::_('select.option', $line->id, $line->name);
if ($line->select == 'Y') {
echo '<SCRIPT>tableau_check.push("fabrikgrid_'.$line->id.'");</SCRIPT>';
return $options;
What do you want to achieve at all
  • Set defaults in a new record?
  • Override the stored data in an existing record?

Members online

No members online now.