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

    Maybe I got it all wrong, but this is what I want to do, but it just ain’t working.
    I have some TVs that are drop down type.
    I want that these dropdown will be default selected as their parent.
    e.g.:
    If in the parent I have chosen the 2nd option in the dropdown, I want that every new document, and every existing document that I edit, will have that same option selected as default.

    So I entered some values in the "Input Option Values:" field, something like this: "option one==[[somesnippet]]||option two||{{somechunk}}||etc...".
    And in the "Default Value:" field, I entered: "@INHERIT".

    This is not working as I described.

    Can anybody correct me if I’m wrong, or explain to me how do I use @inherit?

    Thank you very much!
      • 14281
      • 120 Posts
      I had a lot of problems with this same issue last night; I couldn’t get @INHERIT to work for anything. This was especially strange to me, because it worked on another site that I built without a hitch. But I compared what I was doing last night with the other site, and I couldn’t find any difference. I even created another test TV that had the exact same name and everything else as the one that works on the old site...and it still didn’t work.

      Not only should you be able to put @INHERIT in the default field, but you should also be able to type "@INHERIT [[somesnippet]]||{{somechunk}}". This will work in order of priority, i.e. if the document’s parent has been set to something besides [[somesnippet]] and {{somechunk}} being selected, the document will differ to the parent for its selection values. Otherwise, it will differ to the TV’s default selection, e.g. [[somesnippet]] and {{somechunk}}.

      Not only did @INHERIT not work for me on my current project, but it even disabled the default values that followed it. Not only did it not work for a dropdown menu, but it didn’t work for anything else I tried, e.g. a checkbox array or a text field. Like I said, this is very strange to me, because as far as I know, I’m using the exact same version of MODx for both sites.
        • 25663 MODX Staff
        • 12,272 Posts
        It sounds like there’s a corrupt file in the manger folder related to TV handling on the second install.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 14281
          • 120 Posts
          Hey Ryan, I downloaded the MODx package again, and uploaded the manager folder to my site, in case I had a corrupt file, and it’s still not working.

          Here’s my latest test. I’ve created a TV called "Feeds". It’s a multiselect that I’m going to use to select which feeds I want to make available on a given page. For the input option values, I’ve put "Articles==38||Journal==45", and for the default value, I’ve put "@INHERIT 38". When I go to edit a page, the TV control is there, but Articles is not selected by default, and if I select either or both, the settings do not inherit to the child documents.

          UPDATE: If I remove "@INHERIT" from the default settings, the default settings work; Articles is, in fact, now selected on pages which have not tampered with this TV. However, this is obviously not the complete desired behavior; I really need these settings to inherit.
            • 22303 MODX Staff
            • 10,725 Posts
            @INHERIT does not work like this. It plainly and simply causes values to look up the hierarchy until a customized TV value is found. If @INHERIT is encountered in the TV definition, the default value is quite simply blank. You would need to specify your "defaults" by selecting the proper TV value in every first level folder, which would then be inherited to their children.
              • 14281
              • 120 Posts
              Quote from: OpenGeek at Jun 22, 2006, 12:18 PM

              @INHERIT does not work like this. It plainly and simply causes values to look up the hierarchy until a customized TV value is found. If @INHERIT is encountered in the TV definition, the default value is quite simply blank. You would need to specify your "defaults" by selecting the proper TV value in every first level folder, which would then be inherited to their children.

              Hey Jason. Thanks for the input. Please correct me if my understanding is wrong, but the MODx documentation seems to indicate the exact opposite of what you’re saying:

              http://modxcms.com/inherit-binding.html

              The explanation on that page seems to jive with what you’re saying, but check out the example image, which has "@INHERIT" followed by a default value.

              I tried your approach before (just typing "@INHERIT" in the default values field, and setting the top parents), and I just now tried it again...that’s not working either. The children have nothing selected.
                • 25663 MODX Staff
                • 12,272 Posts
                Jason’s right. Give it a quick test to prove it out. smiley
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 7455
                  • 2,204 Posts
                  @INHERIT defauldvalue should work I use it all the time when there is no change in the parent(s) then the defauldvalue is shown else it will INHERIT the value from the parent.

                  (would be nice if we had a @INHERIT for siblings only)

                    follow me on twitter: @dimmy01
                    • 4369
                    • 31 Posts
                    Hey guys, I’ve lost you somewhere..

                    Jason, did you meant that there is no way to make the parent selected option in a drop down, be "selected" with the use of @INHERIT ?
                    Does this mean that I need to add an "Inherit==@INHERIT||" option and the use will have to choose that option in order for it to work ?
                      • 12652
                      • 228 Posts
                      Okay, I know this is an old thread, but it seems to relate exactly to what I’m experiencing.

                      Prior to upgrading from 0.9.2 I had a TV with something like this:

                      @INHERIT
                        <h2>About CMS</h2>
                        {{About}}
                      
                        <h2>News</h2>
                        [!Ditto.... [i]and the respective call[/i]!]


                      This TV was then placed in the sidebar area of a template and all of the code then showed up on all of the pages. If I changed the TV value in any page to something else, then it changed and all of the subpages of that document inherited that change. If I deleted that main documents TV, then it reverted back to the default TV.

                      This seems to hold true with the documentation on @INHERIT, that you can provide a default value/code/copy/etc. to be used.

                      After upgrading to 0.9.5RC3 and soft launch, the only thing that appears is the first About CMS heading. Even changing the chunk to straight text, in case that was making things funky, had no affect. Once the @INHERIT is removed, then it behaves like a normal TV and appears throughout.

                      What I believe Jason is saying is that you set @INHERIT all by itself in the TV, then make your changes in the top level documents. But this seems contrary to the documentation, my previous experience, and would now mean that you had to have code in all of the top most documents, rather than being able to have a full cascade of default text from the template level.

                      I’d love to have others weigh in on this as it still does not seem to be a clear consensus or understanding... not to mention I’m still pretty sure that it was previously working before upgrading.
                        | Identity Developments delivers SEO focused web design and web presence services
                        - it&#39;s not about websites, it&#39;s about your identity. |