On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Just playing around with MIGXdb and wanted to make use of the childresources a.k.a childstutorial functionality, followed the tutorial step by step, just pasted in the configuration and renamed configuration name/unique id, moved some fields (but all the ones that were present from the tutorial are still there, just reorganized plus added some tvs (included them in the new wettbewerbe.config.inc.php (copy from childstutorial.config.inc.php, so my config is called "wettbewerbe"), so far so good, parent resource has the migxdb and the grid shows up correctly (only autoload messes up a lot^^) when pressing the button. I can add a new child resource, all the tvs are shown in the overlay and also pagetitle, content etc., but when I fill them all out and save, only the pagetitle and content got saved, not the tv values...they show up empty when added to the grid and also if "edit" is clicked again...tv fields all empty.

    the childresource is actually created (didn't hide them in the tree yet) but also with empty tvs, so the values don't get saved...when I add a tv value "manually" to a childresource and save like if I would when editing without migxdb, the value gets saved, BUT is not displayed when reloading the page and loading the grid again...when opening the editing window and saving again the tv value is gone, so there's not just done nothing, tv values are always replaced with nothing = empty string...this gives me the impression that the script has access/sees the tvs but somehow has some problems with handling them correctly (ie save values to them, not empty them =D), I double and tripple checked but couldn't find anything wrong in the setup...

    I'll try to reproduce the tutorial 1:1 tomorrow and see if I have the same issues...but in the meanwhile, maybe somebody is out there that already has an idea what I may be doing wrong?

    thanks for any pointers!
    • OK, bothered me too much, because nobody seems to have similar problems, so I just rebuilt the childresources tutorial (even a reduced one) and see, it worked, so wtf...played around, customized it step by step and it turns out that MIGX hates dots "." in TV or fieldnames^^...I have a naming strategy for my TVs like section.field eg. team.job...everything stopped working as soon as I changed to this naming and it started to work again when I removed the ".", eg. renamed the TV and field (they seem actually to need the same name, do they? so fieldname = tvname?) from "team.job" to "teamjob"...nasty little bug =D...or has this some purpose / reason behind it?
      • To have points in fieldnames isn't a good idea for several reasons.

        The reason why to use points in fieldnames inside of MIGXdb isn't a good idea, is because of this parts in the default-processors:

        update.php

                    $field = explode('.', $field);
        
                    if (count($field) > 1) {
                        //extended field (json-array)
                        $postvalues[$field[0]][$field[1]] = $value;
                    } else {
                        $postvalues[$field[0]] = $value;
                    }


        this part does store fields with points into one (or more) fields as one json-string.

        The part before the point is the name of the db-field.
        The part after is the name of an 'extented' field inside the db-field.

        If you don't need that feature, but you still want to use points in fieldnames, you will need to create custom processors.
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
        • That's fine, good to know, this should probably go into the docs!

          EDIT: Added...don't hesitate to modify it =)
          • Is it right that the fieldnames should be the same as the TV name?

            I'm actually not able to save anything until I make fieldname and inputTV (name) exactly the same, for example if I have the team-job (this time without point =D) TV then the field cannot be called "job" but has also to be "team-job"?
            • The name of the field needs to be the same as the name of your TV, of course.
              The name of the inputTV doesn't matter and you can reuse the inputTV for different fields or you can use the inputTVtype, if you do not need any special configurations for your inputTV.
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
              • Quote from: Bruno17 at Mar 27, 2013, 06:35 AM
                The name of the field needs to be the same as the name of your TV, of course.
                The name of the inputTV doesn't matter and you can reuse the inputTV for different fields or you can use the inputTVtype, if you do not need any special configurations for your inputTV.

                OK thanks, good to know (that wasn't clear to me)! But I thought I have to make real tvs in the childresources scenario, I even need to include them in the .config.ing.php file...so in normal MIGX grid "real" TV's can be avoided but is that true also for the childresources use case?