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

    I am currently wizzing around ditto and I’ve run into a problem. I’m using a dropdown list to specify tags for each entry and it works perfectly until I use spaces or apostrophes in the list items, which then makes the tags not find any results.

    I’m sure this is a basic formatting issue.

    I’m using a TV with the DropDown List Menu and the input values as follows:

    General News & Events || 1st XV || 2nd XV || 3rd XV || Youth Wild Cats || Under 13's || Under 14's || Under 15's || Under 16's || Under 17's || Colts || Mini's Wildcat's || Under 6's || Under 7's || Under 8's || Under 9's || Under 10's || Under 11's || Under 12's


    Any help would be great
      • 11975
      • 2,542 Posts
      Hi,

      did you add the spaces after having attached tag values to documents ?
      If yes, you’ll have to manually update each document.

      :-)
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 29703
        • 217 Posts
        Oops no, it seems spaces are fine, it’s just the apostrophe that breaks it.

        Any ideas?
          • 7231
          • 4,205 Posts
          Just guessing but did you try escaping the single quotes? I have not tried this but you never know, it may make a difference grin
          ...|| Under 13\'s || Under 14\'s || Under 15\'s ||...
            [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]
            • 27376
            • 576 Posts
            Since you are using strings as the values in your TV and not assigning them to keys (eg. "General News & Events==1||1st XV==2"), the values are the same as the keys. What this means is that all the documents you created that utilize this TV that were created BEFORE you added the apostrophes will need to be updated so that the keys match the new values (the ones with the apostrophes).

            This is not really a bug, but it can be confusing for beginners just delving in to Template Variables. It’s pretty low level stuff, so don’t feel bad if you don’t get it yet wink

            It may also be worth it to remove the spaces between your ’||’ as those are considered part of the value (whitespace isn’t ignored) and are saved to the database too.
              • 11975
              • 2,542 Posts


              What this means is that all the documents you created that utilize this TV that were created BEFORE you added the apostrophes will need to be updated so that the keys match the new values (the ones with the apostrophes).


              Hi,

              about this issue, I would recommend you to manage your tvs options through tvEditor which updates all tvs values attached to documents when options values are changed.

              :-)
                Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                • 18397
                • 3,250 Posts
                Quote from: sirlancelot at Jan 07, 2008, 10:49 AM

                It may also be worth it to remove the spaces between your ’||’ as those are considered part of the value (whitespace isn’t ignored).

                In the latest versions of Ditto, front and end whitespace of tags is ignored using php’s trim function.
                  • 27376
                  • 576 Posts
                  Quote from: Mark at Jan 08, 2008, 11:13 AM

                  In the latest versions of Ditto, front and end whitespace of tags is ignored using php’s trim function.
                  Cool, but I was actually talking about the values being saved to the database... I’ve updated my response to better reflect what I meant.