1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

JSON in database

Discussion in 'Community' started by winchester, May 20, 2019.

  1. winchester

    winchester Member

    Level: Community
    Hi.

    Is it possible to store the input from multiple field/elements in JSON format into the database like Joomla does?

    If it is possible, can you please tell me how to do it, please?

    Any help will be appreciated. Thanks in advance.

    Winchester
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Not sure what you mean.

    -- hugh
     
  3. winchester

    winchester Member

    Level: Community
    Thanks for your reply. I am very new to Fabrik and I'm just learning my way around the extension. So far, it's been difficult to find proper answers.

    Ok, this is what I wanted: On the form, I have a textarea in which the user is asked to make a list of things. Only the detail page, I want that listed items to be displayed in a list (not a line of words) and so I thought that JSON could work to store the data/list of items to the database.

    I'm thinking this wouldn't be necessary in JSON format. I'm now thinking that it would be better to save it to a textbox with the listed items comma separated. I think it would be easier to format it into a list (unordered list) when pulling it from the database instead.

    Now, my question is, after setting up the element/field, how would I be able to format it... Keep in mind that I don't yet know where to do what, so you will have to tell me where to go to do what..

    Thank you in advance.
    Wincehster
     
  4. troester

    troester Well-Known Member Staff Member

    Level: Community
    What is this "list of things", are the "things" predefined? Maybe you can use a checkbox element or a databasejoin rendered as checkbox?

    Or a repeat group with a simple field element.

    With those elements you can handle "list items" directly without having to manipulate unstructured strings.
     
  5. winchester

    winchester Member

    Level: Community
    Ok.. It's a survey for public beaches. One of the question asks, "What other activities do you offer?". We expect answers like:
    ----
    Water Sports
    Beach Volleyball
    Beach Parties
    Live Performances
    ----

    I could give instructions that they use a comma to separate each activity or, if it's a textarea, then each activity in a new line.

    My question is, which is the easier way yo go about it, how do I do this and is there any special settings or scripts to get it done.
     

Share This Page