We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1778
    • 659 Posts
    Hi all

    As far as I understand, when you create a customTV (input and output types) its value is stored as a JSON array like this (dummy code for an hypothetical item stored in custom DB)
    {"item_id":123, "item_name":"dummy_prod","item_url":"url/to/file"}
    

    My question is : is it possible to have a tv value stored as an array of arrays ? Something like
     [
       {"item_id":123, "item_name":"dummy_prod","item_url":"url/to/file"}
       {"item_id":13, "item_name":"other_prod","item_url":"url/to/file"}
       {"item_id":456, "item_name":"other_prod","item_url":"url/to/file"}
       ...  
     ]
    

    and then output each item in a placeholer, something like '[ [+itemX] ]' ,where X is the index of the item in the tv value array
    I Hope I'm clear...

    Other question, around this... All the custom TVs I've looked in the code, seem to use only one form as input for the TV.
    Is it possible to use several forms (each form with its own id, for each product) and then aggregate their respectives inputs in the tv value as array of arrays ?

    Cheers
      • 4172
      • 5,888 Posts
      isn't it exactly that, what MIGX does?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 1778
        • 659 Posts
        @Bruno,

        I have to look deeper in MIGX so, to understand how you achieve that...
        Cheers
        Thanks for pointing me to it, but just another question before diving, I guess you use only one form (when I say one form I mean only one MIGX form is filled by user when creating/updating a resource), Do you think it's possible to use something like a tabpanel, with a form inside each tab ?
        I'll dive into MIGX to try to understand how you did it, my problem should be less complex as I don't want to 're-use' other tv values, but only items with same data structure...
        My problem was that the numbers of these items can vary fro a resource to another... (not sure i' very clear)...
        Thanks again
        I'll try today and post here again if I have any blocking point...
        Cheers
          • 37743
          • 49 Posts
          Custom TVs can have any UI / form interface you want, it's all about how you transform the data before you save it. The TV field in the database itself only has one value, so before a user saves the resource (or whenever one of your fields changes) it should update a hidden 'value' field with the json data you want to save.

          The only downside to this is that you then have to output-filter all calls to this TV (as MIGX does with it's snippet). Not much of an issue, but an extra step to take.

          Out of interest how much data are you trying to store in one TV? MIGX offers multi-tab forms if thats all your after.