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

    We have an unusual issue, we have several templates with both single and multi selection’template variables’, while they post selections to the public site one of our selection variables fails to store the setting with the admin UI. So if the client edits a documents using the TV they will need to select the TV every time otherwise the value will be set to null.

    This courses major head-aces for our client, as the lose settings and often lose important inclusions for special site menus.


    Is this a known problem, is there any fix.

    Regards,


    M
      Martin Sanders - Design & Web Development
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      This doesn’t sound like a common problem...

      Can you set a default value for the template variable? You’d do this in the control panel on the page where you created and named the template variable. This is a good option if ALL instances of that variable can have the same value (e.g. yes/no).

      If each instance of the template variable needs to have a unique value depending on the page that it’s on, then the solution is a bit trickier, but what I’ve read about other people doing is writing a simple plug-in. If you haven’t dealt with plug-ins before, they’re just like Snippets (i.e. bits of PHP code), except instead of being executed when a page loads, they get executed when a certain event happens. You can use a plug-in to validate the user input in the manager -- you can check the value for a given template variable and if it’s empty (for example), then you can calculate a default value for it before you save the document.

      Search the forums for template variables and plugins (or plug-ins) and see if you can’t find some threads where this technique was discussed.

      Does that help? I hope so...
        • 7231
        • 4,205 Posts
        How is the TV setup and what kind of TV is it? How is the Output Widget setup? For multiple options I think a delimited list is needed.
          [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

          Something is happening here, but you don't know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 19975
          • 429 Posts
          hi, the template variable uses the "DropDown List Menu" with Input Option Values separated with ||. The Widget has been set to null "not selected".

          Do I need to set a default? and how would I do this?
            Martin Sanders - Design & Web Development
            • 9207 ☆ A M B ☆
            • 2,475 Posts
              • 19975
              • 429 Posts
              Thanks for the info Everett,

              Everything seems to be correct in regards the set-up. I can only guess I’m experiencing a bug.

              Any idea on how I resolve the bug?
                Martin Sanders - Design & Web Development
                • 9207 ☆ A M B ☆
                • 2,475 Posts
                Can you please post EXACTLY how you have the TV set up? The name, description, default, type, widget, EVERYTHING.

                Then post for us EXACTLY what you are entering into a page for that variable?

                I just can’t tell what you might be experiencing without the EXACT details.

                Thanks!
                  • 19975
                  • 429 Posts
                  Hi Everett,

                  The TV has been set as follows (please view image)


                  http://www.sandersdesign.com/modx-webpostimages/error.jpg

                  I’m using 0.9.6.3.

                  Thanks for the help smiley
                    Martin Sanders - Design & Web Development
                    • 4310
                    • 2,310 Posts
                    I think you need the Widget: set to Delimited List
                    Also try the Input Option Values: without breaking them onto a line each.
                      • 19975
                      • 429 Posts
                      Thank, I’ve removed the line breaks and all is good. Thanks for the feedback. One to remember for future ref wink
                        Martin Sanders - Design & Web Development