Forums

editing record with model ID from listing

admin_wiky 09 Aug, 2013
Hi all,

I created one connection to one table, listing works. I have set up editable field that works correctly if I click on this field the data are shown in CF form.
Now I need to set up a second table in same connection (use multitables) and so I have to use a model id.
I set up model id in general tab, List View Fields, edit fields, binary fields (like model_id.field:column_name). Listing is correct, but if I click on editable field of the record, the CF form is showing without data in fields.

Where am I doing a mistake?

thanks a lot
GreyHead 06 Oct, 2013
Hi sloanthrasher,

The input name has to be a text string - the {} won't work there.

Either it needs to be an array name to match the data you are loading e.g. a[name], or you need to pre-process the data to copy the values you need into the root of the $form->data array e.g.
<?php
$form->data['name'] = $form->data['a']['name'];
?>

Bob
admin_wiky 04 Jun, 2014
Hi Bob,
I have a question about CFv5. In new version I have problem with this code
<?php
if ($form->data['zakladni']['0']['zakladni']['aktivni']==1)
echo '<img src="../portal/components/com_chronoconnectivity/images/tick.png" border="0">';
else echo '<img src="../portal/components/com_chronoconnectivity/images/publish_x.png" border="0">';
?>

it worked in previous version CFv4.

thx
Max_admin 05 Jun, 2014
Where do you use this code ?

You can try the $row variable in the Body box

But the correct way to do this in v5 is to use the "Images" box:

Model.field:array(1 => "path to enabled image", 0 => "path to disabled image")


Please note that array keys (1, 0), they must match the field values, and you can add more options, so if your field may have 4 different values then you can use 4 different images!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
admin_wiky 06 Jun, 2014
Hi Max,

thx 4 reply, but I am not sure if I understand u.
if I use:
zakladni.aktivni:array(1 => "../portal/components/com_chronoconnectivity/images/tick.png", 0 => "../portal/components/com_chronoconnectivity/images/publish_x.png");

then nothing happend, I did use echo, return, but without result. I thing, something is missing🙂
thx
Max_admin 06 Jun, 2014
This is the latest CCv5 RC4 ?

The code should be in the "Images" box, and the images paths should be correct and absolute (with http), please try the code in the "HTML" box, that will display the image path instead, so you can make sure that its working as expected!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
admin_wiky 09 Jun, 2014
Hi Max,
yes, RC4.
I wasnt exact about code. I have this code placed in front list -> action -> view. That is part of code is viewing data.
Max_admin 11 Jun, 2014
Oh, if this code is inside the action code then please try to use $row instead of $form->data['zakladni']['0'] in your original code!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
admin_wiky 11 Jun, 2014
I understand u, but I use different types of models. row aktivni is in model zakladni.
which way I can use model id in syntax $row?
thx
admin_wiky 11 Jun, 2014
I tried put this code to CFv5 form (view action -> custom code) and condition works, so I dont know why same code doesnt work in CCv5
Max_admin 15 Jun, 2014
Answer
Please try:

$row["model"]["field"]
or
$row["model"][0]["field"]
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.