Forums

chronoconnectivity V5 How to handle arrays

tvdgreft 27 Nov, 2014
Where is Array fields (available in general/advanced tab in chronoconnectivity v4) in chronoconnectivity V5 to indicate the fields with concateneted array values, in order to extract these values to an array, when they the data is loaded? This is necessary to display the checkbox groups in the edit form.
Max_admin 01 Dec, 2014
Hi tvd,

Just add the action above the HTML action in the "on load" event of your edit form, it should work fine there too!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
tvdgreft 01 Dec, 2014
Which action do you mean?
Max_admin 01 Dec, 2014
Sorry, I was wrong!🙂

You need a "Custom code" action before the "html" action in order to extract the values, since CCv5 doesn't have this feature.

Just use 1 line of PHP code per field:

<?php
$form->data["field"] = explode(",", $form->data["field"]);


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
tvdgreft 01 Dec, 2014
HI Max,

My fieldname is: muziekinstrument and the model defined in chroconnectivity is: gebruiker

I tried:
<?php
$form->data["gebruiker[muziekinstrument]"] = explode(",", $form->data["gebruiker[muziekinstrument]"]);
?>

and
<?php
$form->data["muziekinstrument"] = explode(",", $form->data["muziekinstrument"]);
?>

Both actions results in an empty checkbox group

Theo
Max_admin 03 Dec, 2014
Hi Theo,

It should be:

<?php
$form->data["muziekinstrument"] = explode(",", $form->data["gebruiker"]["muziekinstrument"]);
?>


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
networkx 22 Mar, 2015
I am having a similar problem with an edit form I am trying to create. I have a field called 'mCities' that is tied to a multiple selection drop down. When there is only 1 city selected, the edit form looks fine. When there are multiple cities in the database, none are selected when it populates the edit form. All the other fields are fine. I have tried the 'handle arrays' function and also tried the above suggestion using:
<?php
$form->data["cmodels"]["mCities[]"] = explode(",", $form->data["cmodels"]["mCities"]);
?>
The debug shows:
[cmodels] => Array
(
[mID] => 7
[mCities] => Atlanta,Los Angeles,NYC

I am at a total loss. Any suggestions?
The page in question is at: http://adonis.carbendata.com/index.php?option=com_chronoconnectivity5&cont=lists&act=index&ccname=ModelInfoEdit

Thanks in advance for any help!🙂
Max_admin 22 Mar, 2015
1 Likes
This should be the code:

<?php
$form->data["cmodels"]["mCities"] = explode(",", $form->data["cmodels"]["mCities"]);


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
networkx 22 Mar, 2015
That did the trick! Thank you so much!! 😀
This topic is locked and no more replies can be posted.