We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30491
    • 44 Posts
    Thanks benmarte, but i've tried that, the issue is bigger than that. I'm only using double brackets in that way, for performance reasons. Check this link out for more info: http://modx.com/blog/2012/09/14/tags-as-the-result-or-how-conditionals-are-like-mosquitoes/
      • 3109 ☆ A M B ☆
      • 894 Posts
      Ok I just tried it and you are correct it does display the TV's default value even though the template does not have access to it so I suggest you make a No option and set that as the default value to solve your issue or don't specify a default value and make sure to leave the Allow Blank checkbox enabled.

      This should be filed as a bug in the tracker.
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
        • 30491
        • 44 Posts
        Thanks for testing it out--as for creating a 'NO' option, the issue still persists, templates that shouldn't have access to that TV, still do, albeit the value will reflect the default value set (even if its a 'No'). And in my particular case, I only have a few odd cases where I want this TV set to 'No', otherwise I want the default value to be set to 'Yes'.

        I may file it as bug, although it appears to have been filed (and closed) here: http://tracker.modx.com/issues/1852

        In mean time, just looking for a way around this dilemma.
          • 3109 ☆ A M B ☆
          • 894 Posts
          The only way a Template that doesn't have access to this TV render it is if you're explicitly including it in the content area or any other of the property fields which would technically give it access to it's default value.

          There is no way for it to access it otherwise unless you have the TV in the template.
            Benjamin Marte
            Interactive Media Developer
            Follow Me on Twitter | Visit my site | Learn MODX
            • 30491
            • 44 Posts
            I thought of that as well, so I tested it, by instead putting it into the two separate templates, one with access to the TV and one without. The result was the same.
              • 3109 ☆ A M B ☆
              • 894 Posts
              Can you post the code for both of your templates?
                Benjamin Marte
                Interactive Media Developer
                Follow Me on Twitter | Visit my site | Learn MODX
                • 30491
                • 44 Posts
                Sure, its pretty simple test I conducted.

                Template 1 & 2:
                <html>
                <head>
                <title>[[++site_name]] - [[*pagetitle]]</title>
                <base href="[[++site_url]]" />
                </head>
                <body>
                <hr>
                Empty
                [[*createPDF:is=``:then=`<br><b>TV is EMPTY</b>`]]
                <hr>
                Is=1
                [[*createPDF:is=`1`:then=`<br><b>Create PDF</b>`]]
                [[*content]]
                </body>
                </html>
                


                Template 1 has access to 'createPDF' and Template 2 doesn't. Yet, both result in 'Create PDF' meaning the TV is processed in both templates.
                  • 3109 ☆ A M B ☆
                  • 894 Posts
                  It seems you're confusing how TV's work both templates have access to it, here's what Template 1 should look like with access to the TV:

                  <html>
                  <head>
                  <title>[[++site_name]] - [[*pagetitle]]</title>
                  <base href="[[++site_url]]" />
                  </head>
                  <body>
                  <hr>
                  Empty
                  [[*createPDF:is=``:then=`<br><b>TV is EMPTY</b>`]]
                  <hr>
                  Is=1
                  [[*createPDF:is=`1`:then=`<br><b>Create PDF</b>`]]
                  [[*content]]
                  </body>
                  </html>
                  


                  Template 2 without access to the TV should look like this:

                  <html>
                  <head>
                  <title>[[++site_name]] - [[*pagetitle]]</title>
                  <base href="[[++site_url]]" />
                  </head>
                  <body>
                  <hr>
                  Empty
                  
                  <hr>
                  Is=1
                  
                  [[*content]]
                  </body>
                  </html>
                  


                  Anytime you include:

                  [[*createPDF]]
                  


                  In your template it has access to the TV what you are doing is using an output modifier to check the value of the TV but both templates have access to the TV which is why in Template 2 it is rendering it's default value.
                    Benjamin Marte
                    Interactive Media Developer
                    Follow Me on Twitter | Visit my site | Learn MODX
                    • 30491
                    • 44 Posts
                    I see, ..so all templates have equal access to TV's? That is very confusing considering MODX documentation says "TVs are Template-specific, meaning they can only be used in Templates that they are assigned to."
                      • 3109 ☆ A M B ☆
                      • 894 Posts
                      Template Variables are template specific, the only way to access a TV is by calling it in your template:

                      [[*createPDF]]
                      


                      When they say that templates don't have access to a template variables they are talking about having access to it via the Template Variables Tab in the manager not the front end.

                      So In template 1 as you can see on line 9 we are calling it and we are using an output modifier to render TV is empty if the TV is empty but since your TV has a default value it is not empty.

                      In Template 1 if you go to the Template Variables tab you will see you have access to the createPDF checkbox.

                      In template 2 you can see lines 9 and 11 I removed the call to the TV so it won't render it in that template the only way the TV will render on Template 2 is if you specifically call it in the content area or one of the other fields provided by MODX so if you put:

                      [[*creatPDF]]
                      


                      Now go to Template 2 Template Variable tab and you will not have access to the createPDF TV because the Template does not have access to it unless you duplicated Template 2 from Template 1 and left the TV access checkbox on it.

                      Inside the content area of Template 2 it will render it's default value even though the template does not have access to it on the Template variable tab in the manager side it will still render on the front end because it has a default value.

                      Hopefully that clears it up for you. [ed. note: benmarte last edited this post 13 years, 2 months ago.]
                        Benjamin Marte
                        Interactive Media Developer
                        Follow Me on Twitter | Visit my site | Learn MODX