• Holiday Schedule

    Your code gophers will be away for the next couple of weeks so support will be sporadic. We should be fully back online by the end of September.

  • A new version of Full Calendar is now available.

    See the details here

Calc element displays json string in details view

EricWebsite

Member
Hi,

I have several databasejoin / checkbox elements in my list. In list and details view the values are displayed properly.
But I want to display the values with calc as some manupulation of the data is needed.
If I put
Code:
return '{listname___databasejoinname }';
in the calc element, it works fine in list view.
In details view however, a json string is displayed like this:
Code:
["value1","value2","value3","value4","value5"]

System details:
Fabrik 4.1 git date 06-04
PHP 8.2.20
Joomla 5.1.1
 
To clearify: in the calc field I combine the values of the databasejoin/checkbox element and a text field in which here the user can write free text:
Code:
$out_diseases = '{researcher___diseases}';
if ('{researcher___diseases_other}')
{
$out_diseases .= '<br />' . '{researcher___diseases_other}';
}
return $out_diseases;
In a list, this works fine (screenshot in_list.jpg). The text field is just added under the list of dbjoin values.
In a details readonly form the dbjoin values are displayed as a json string (screenshot calc_in_details_read_only_form.jpg).
 

Attachments

  • calc_in_details_read_only_form.jpg
    calc_in_details_read_only_form.jpg
    12 KB · Views: 79
  • in_list.jpg
    in_list.jpg
    10.2 KB · Views: 87
Last edited:
Database checkbox is a "complex" element.
https://fabrikar.com/forums/index.p...t/#retrieving-data-from-complex-elements-8203

So you won't have a common placeholder for ajax observe, you must add the element placeholder into "Ajax observed fields" if you want to use Ajax calculation.

But there's some bug in the Ajax calculation, on my site it's adding duplicates (only in form view during ajax update, it's storing correctly).
 
Last edited:
Back
Top