• New Commercial Services Section

    We have now opened a commercial services section here on the forum. If you have a Fabrik project that you wish to have someone work on for you, post it under Help Wanted. If you are an application developer and wish to earn some money helping others, post your details under Fabrik Application Developers.

    Both of these are unmoderated. It will be up to both parties to work out the details and come to an agreement.

Text Area shows "Array" on adding the json data

ritesh123

Member
Hi All

I am using Joomla 3.8.2 and latest Fafbrik from Github
I am having a List which is joined to another List as 1 to many under join section of list

In the second list, i have a text area element.
When i add a json code here to display as text, it appears as "array" on reload or or once i revisit by editing the form

I have done following configuration
1.Joomla text filter, kept as No Filter for that user group
2. This works well for HTML and XML data
3. I am using Joomla plugin editor as Core Mirror
4. problem is there only with json as my json format is like this


{ "reportRequests": [ { "abcd": "1234", "dateRanges": [ {"endDate": "today", "startDate": "today"} ], "metrics": [ {"expression": "test"}, ...................................................................... ], "dimensions": [ {"name": "userType"}, ................................................................................... ], "pageToken": "1", "pageSize": "100000" } ] }

From the json as a text area value, you can see it is having an array

Looks like Fabrikar Text Area element is converting this to deafult value to "Array", how can i fix this?

FYI, i have tested this in Article, this works well there.
 
Last edited:
I can't replicate (with current Joomla and JCE editor).
Did you try with an other editor or with textarea without WYSIWYG?
 
Hi I have tried with both Code Mirror and Tiny Mice both

In both the case i get this error
In Tiny Mice, it converts it to <p> json data </p>, but i need it without paragraph tag, when i use it with <> Source code, and paste the json, then it also does the same
I can escape paragraph tags with some post processing in Database, but there other problem is the click button does not work to add new rows.
So i am sticking to Code Mirror editor

In the element i have tried both the options to set the WYSIWYG Editor option, in both the case i get the "Array"
 
upload_2019-5-25_16-49-50.png
this is the screenshot
 
No, I can't replicate (nor with CodeMirror, nor JCE, nor frontend, nor backend, nor textarea wjthout WYSIWYG). All is working fine with exactly your JSON example.
I didn't try with the outdated J!3.8.2 (recent version is 3.9.6)
 
Thanks for your response, it works well for the first SAVE, but when we come back again to form and reload the form in edit view it shows "Array"
Anyways. Thanks for your result.
 
but when we come back again to form
Yes, I understood. But I can't replicate.
What is stored if you are looking directly into your database with phpMyAdmin?
Any 3rd-party system plugin ect. which may "interpret" the JSON syntax?
 
There is no third party plugin
On edit and reload and re-save second time, it saves the word "Array" in database also
 
If you are saving "Array" it surely will be in the database afterwards.
My question was about what is in the database after saving the form with the JSON string?
Do you have form plugins?
 
Hey troester, i found the issue, i think you should try this json, i am sure you can reproduce now.

{ "reportRequests": [ { "viewId": "1234567", "dateRanges": [ {"endDate": "yesterday", "startDate": "yesterday"} ], "metrics": [ {"expression": "ga:users"}, {"expression": "ga:sessions"}], "dimensions": [ {"name": "ga:userType"}, {"name": "ga:campaign"} ], "pageToken": "1", "pageSize": "100000", "samplingLevel": "LARGE" } ] }
 
This thread you mention is more than 10 years old, about Fabrik1.0, so surely not the same issue.

Yes, with your new example it's replicatable.
@cheesegrits :
Textarea in repeat group (it's ok in a normal group, it's also ok with a normal field in repeat group). It's saving the correct text into DB but transforming to "Array" on load (and then it's naturally "Array" in the DB after save).
 
I can't replicate this, using any of the WYSIWYG editors. That JSON string gets saved correctly.

Also, that thread you pointed to was from 11 years ago, in Fabrik 1.x, so very unlikely to be relevant, as the code has been completely rewritten from scratch since then.
 
This thread you mention is more than 10 years old, about Fabrik1.0, so surely not the same issue.

Yes, with your new example it's replicatable.
@cheesegrits :
Textarea in repeat group (it's ok in a normal group, it's also ok with a normal field in repeat group). It's saving the correct text into DB but transforming to "Array" on load (and then it's naturally "Array" in the DB after save).

Ah, in a repeat group.

I'll take a look.

-- hugh
 
Meh. OK, here's a kind of hacky fix for this:

https://github.com/Fabrik/fabrik/commit/61e47167d345fa7b98c2ec3fc2dcf228eb610750

The problem being that many years ago when we designed how repeat data works, we didn't anticipate people storing JSON data of their own, so we use JSON internally, and decode it during the process of folding repeated joined data rows into individual repeated elements.

This hack will fix this issue for the specific case of textarea elements in a repeat group. Although there are still potential issues with that, for instance if you have a join element in the same group, you'll see warnings about arrays being uses as strings.

-- hugh
 
Ok now in form and details view.

In list view the textarea is empty if it's pure valid JSON (normal group and repeat group, not related to this commit, it was already before)
 
Hmm, now in list view (merge rows) JSON text is showing up but the repeat textarea is loosing the "<ul class="repeat data",... <li..., 3 groups with some text (no JSON) with some HTML tags look
upload_2019-5-27_21-22-27.png instead of upload_2019-5-27_21-24-50.png
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top