Forums

Dynamic data not working?

wimste 13 Apr, 2012
Hello,

First of all, I really really like your add-on for Joomla!! Currently I'm trying to create a form in Joomla 2.5 with CFv4 RC3.3. But I can't get the options 'Dynamic Data' for the checkbox-group to work. I want to load a form based on the 'cf_id' of a table (jos_kalender). In that table there is a field 'spelers' which hold an comma separated string of the cf_id from another table (jos_spelers -> which holds all info about my players).
Now I want my form to display all data from jos_kalender, but my checkbox-group needs to load all possible players and be checked whenever the players cf_id is also found in the field 'spelers'.
So in the actions tab I place a DB_RECORD_LOADER to load one record from jos_kalender. When a record is found, it should load all players.
The problem is that when I enable 'Dynamic Data' that my entire website shows blank (except for the label).

PS: I attached some screenshots assuming that this could be usefull to provide me some help/a solution.
PPS: This is the result of the debugger:
Array
(
[option] => com_chronoforms
[chronoform] => testKal
[token] => 01e3cfc3e5e9a748f7a043716ba598ca
[order] => alias
[direction] => desc
[Itemid] =>
[cf_id] => 3
[cf_uid] => 01e3cfc3e5e9a748f7a043716ba598ca
[cf_created] => 2012-04-06 22:10:58
[cf_modified] =>
[cf_ipaddress] => ::1
[cf_user_id] => 42
[seizoen] => 2
[datum] => 2012-04-05
[baan] => 15
[tegenstander] => 12
[spelers] => Array
(
[0] => 9
[1] => 11
[2] => 12
[3] => 13
)

[JosSpelers] => Array
(
[0] => Array
(
[cf_id] => 9
[alias] => aaa
)

[1] => Array
(
[cf_id] => 12
[alias] => bbb
)

[2] => Array
(
[cf_id] => 11
[alias] => ccc
)

[3] => Array
(
[cf_id] => 13
[alias] => ddd
)

)

)
Validation Errors:
Array
(
)



I really hope that you understand my issue :-S

Kind regards,

Wim
GreyHead 13 Apr, 2012
Hi Wim,

The code all looks OK - although I would put the DB Multi-Record Loader after the DB Record Loader instead of in the On Success event.

The blank page is usually a sign of a PHP error, please try setting Site Error Reporting to Maximum in the Global Configuration setting and see if you get a more useful error message.

Bob
wimste 13 Apr, 2012
Hi Bob,

Thanks for your analyse and quick response!
In the meanwhile I've managed to find a solution myself, altough I don't know how it works 😀
In the onload event I only kept one DB_RECORD_LOADER just to load all variables from the table jos_kalender and then I created a custiom element with following code:
<div class="ccms_form_element cfdiv_checkboxgroup" id="autoID-1bfc8923b89162f72cc9335e218eb4ac_container_div"><label>Wie moet spelen</label><input type="hidden" name="spelers" value="" alt="ghost" />
<div style="float:left; clear:none;">
<?php
$db =& JFactory::getDBO();
$query = "SELECT * FROM `#__spelers` ORDER BY alias ";
$db->setQuery($query);
$data = $db->loadObjectList();
foreach ( $data as $d ) :
?>
<input type="checkbox" name="spelers[]" title="" value="<?php echo "$d->cf_id" ?>" class="" />
<label for="spelers_0"><?php echo "$d->alias" ?></label>
<?php
endforeach;
?>
</div><div class="clear"></div><div id="error-message-spelers"></div></div>

As said, I don't understand how, but now it works...
If possible, can you explain how this works? Cause maybe I (or someone else) needs it to.
Thanks!

Kind regards,

Wim Stevens
GreyHead 13 Apr, 2012
Hi Wim,

That is listing all the players from the table, not just those that are linked to the particular game. You have coded by hand what the Dynamic Data tab tries to do for you.

Bob
wimste 13 Apr, 2012
Bob,

I also thought that this code only shows all the names of the players, but strange enough, this code does check all the boxes where a player is 'needed' and unchecks those where it doesn't , all according to the field spelers in jos_kalender.
That's why I could not understand what I did wrong before or how this code knows which box to check.
I've attached a new screenshot to show you the result.

Kr,
Wim
This topic is locked and no more replies can be posted.