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

Answered Target not set

    • 46434
    • 22 Posts
    After installing 2.3.4 on one of my sites i created some resources and tried to order them via drag-n-drop i got the message "target not set".
    (original post: http://forums.modx.com/thread/97558/2-3-5-drag-n-039-drop-in-resource-tree#dis-post-530705)

    I've been having this issue since 2.3.5. Today I updated to 2.4, but that did not fix it.

    I also:
    - I cleared MODX cache
    - Flushed sessions
    - Delete all files and folders in core/cache
    - Cleared all browsercache
    - Re-installed 2.4

    But am still having this issue.

    Has anybody found a reliable solution?

    To clarify, the issue is the following: When attempting to reorder a resource from the tree menu, I receive a dialog with the message "Target not set". Also, the resource fails to reorder.

    I've attached a screenshot.

    This question has been answered by dave-b. See the first response.

      • 3749
      • 24,544 Posts
      Sometimes MODX gets confused when you drag things around and a resource gets an invalid parent. It could be its own parent or to resources could be set to be each other's parent. That could be what's happening (though I've never seen that message). If you can see the resources in the tree, you could check their parents.

      SiteCheck will also do a bunch of validity checks on all the site's resources (among other things).
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 46434
        • 22 Posts
        I get the "Target not set" dialog no matter what resource I try to reorder in the tree. I've checked, double checked, and triple checked the parents of each resource I've tried to reorder and they all have no parents, which is the way it's supposed to be at the root of the web context.

        It looks like the message is generated from 'core/model/modx/processors/resource/sort.class.php' in modResourceSortProcessor::process(). In ModX 2.4, this is line numbers 43-57:
        $target = $this->getProperty('target', '');
        $source = $this->getProperty('source', '');
        $point = $this->getProperty('point', '');
        
        if (empty ($target)) {
            return $this->failure('Target not set');
        }
        
        if (empty($source)) {
            return $this->failure('Source not set');
        }
        
        if (empty($point)) {
            return $this->failure('Point not set');
        }
        


        If I comment out the check for $target, I get a "Source not set" message. Likewise, if I comment out the checks for both $target and $source, I get a "Point not set" message. And if I comment out all checks, I don't get a dialog, but the resource still does not sort.

        I really need a solution to this. I've tried reinstalling ModX a number of times and nothing seems to help. The only thing that seems to work is a downgrade to version 2.3.4.
        I'm pretty certain it's a ModX bug, and was most likely introduced after that version.

        Does anybody have any kind of solution to this, other than a downgrade?
          • 3749
          • 24,544 Posts
          The question is, why aren't the rest of use getting this in 2.4.0. I can drag-and-drop resources with no trouble in any context. Obviously, that doesn't help you, but it suggests an issue with your particular site or platform.

          You might try Manage -> Clear Cache -> Refresh URIs, though I think it's unlikely to help.

          One possibility is a missing or corrupted file. This is common if you transferred the files individually with FTP. Reinstalling MODX from the same files wouldn't help. You could try installing UpgradeMODX and setting the settings_version System setting to 2.3.9-pl. UpgradeMODX will download the files directly and launch setup.

          Another possibility is a plugin that's interfering with the process. Do you have any resource-related plugins? ResourceWatcher and StageCoach come to mind.

          Finally, you could be using an older version of PHP that's not compatible with 2.4.0.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 46434
            • 22 Posts
            I pull the new version from the github repository to update. After carefully examining the "Install Options", I noticed the second checkbox under "Advanced Options" is always checked by default (Core Package has been manually unpacked...), so that's the option I've been using. The third option (Files are already in-place...) is always greyed out, but since the description states "Check this if you are using MODX from Git...", I decided to forcibly check it by modifying the DOM with firebug. Lo-and-behold, it worked! I can recreate a "broken" install by re-copying the files and reinstalling the with second option checked, and recreate the correct install be using the third option.

            Now I'm wondering why the third option is always greyed out...

            I have a "hardened" install, meaning my "core", "connectors", and "manager" folders are named differently. To install, I pull the new modx version from the github repository, and do a selective copy (actually, I've written a script to do the copying for me). So, for example, I copy all the files from within the new "manager" to directory to my own manager directory, and the same goes for the connectors folder. The core folder is a little trickier as I don't want to overwrite my own config, import, export, or packages directory...but I am careful to copy the newer core/packages/core/ and core/packages/core.transport.zip to my own packages directory.

            Anybody know why that third option would always be greyed out?
              • 3749
              • 24,544 Posts
              I don't know about the third option, but UpgradeMODX will check for a new version at GitHub, then see if it's downloadable at modx/com/download. It it is, UpgradeMODX will install if for you (even with a hardened install). Quite a bit less trouble than what you're doing, although you won't get nightly builds with it, just rc and pl releases. You'll have to manually enter your core path during setup, because Setup isn't smart enough to check the config.core.php file.

              It's still an RC version (pl coming soon), but people don't seem to be having any trouble with it.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 46434
                • 22 Posts
                I did give UpgradeMODX a try, and it worked great with my hardened install. Actually the fact that it worked is what led me to a closer examination of the install process.

                I did notice one issue with the widget. Here are the steps I took:

                • I set the modx version in system settings to 2.3.9-pl
                • I loaded the dashboard, and clicked the upgrade button
                • The upgrade widget displayed the message "Version list session variable not set"
                • Reloading the dashboard and clicking the upgrade button produced the same message
                • To resolve, I loaded the system settings screen, and then reloaded the dasbhoard, after which clicking the upgrade button took me to the upgrade page
                • I can consistently reproduce this

                Other than that, great extra, and I look forward to the pl release.
                  • 3749
                  • 24,544 Posts
                  I could be wrong, but I don't think loading the System Settings panel was a factor, you just needed to wait until the 60 second delay between checks ran out.

                  I've released a new version with a fix for this -- hopefully with no problematic side effects. It puts the data in a cache file rather than in a $_SESSION variable.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                  • Quote from: ahaller at Sep 01, 2015, 08:36 PM
                    To install, I pull the new modx version from the github repository, and do a selective copy (actually, I've written a script to do the copying for me). So, for example, I copy all the files from within the new "manager" to directory to my own manager directory, and the same goes for the connectors folder. The core folder is a little trickier as I don't want to overwrite my own config, import, export, or packages directory...but I am careful to copy the newer core/packages/core/ and core/packages/core.transport.zip to my own packages directory.

                    When installing from Git, be sure you are running the build process locally before running /setup, e.g.
                    php _build/transport.core.php


                    https://rtfm.modx.com/revolution/2.x/getting-started/installation/git-installation#GitInstallation-RuntheBuild
                    From the command line, change your working directory to _build/ and execute the command "php transport.core.php".
                      Mike Reid - www.pixelchutes.com
                      MODx Ambassador / Contributor
                      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                      ________________________________
                      Where every pixel matters.
                      • 46434
                      • 22 Posts
                      I ran _build/transport.core.php from the command line and then re-ran the setup, however the third checkbox option (Files are already in-place...) on the Install Options page is still greyed out. Any ideas why?

                      Some good news though, after running the build script, and THEN running setup, having the second option checked seems to work fine.