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

    I’m trying to set up a minimal blog with categories. So, I made a template variable like this:

    Variable Name: BlogCategory
    Caption: Zee Blog Category
    Description: Category of the blog post
    Input Type: Check Box
    Input Option Values: Baby||Garden||Website
    Default Value: Baby
    Widget: Delimited List
    Delimiter: ,
    Sort Order: 0

    All Templates and Document Groups are allowed to use this.

    So, when I make a new document, I see my TV, and all three choices for it (Baby, Garden, Website). However, if I unclick Baby and click Garden and then save it, it still ends up with Baby selected.

    What am I doing wrong?


    Web Server:
    ----------------
    PHP version: 5.1.4-p10-gentoo
    MySQL version: 14.7
    Operating System and version: gentoo, up to date with emerges

    Browser/Client:
    -----------------
    Browser name and version: Firefox 1.0.7
    Operating System and version: Windows XP Pro (up to date with updates)
      • 19220
      • 26 Posts
      I’d be happy to provide more information, screen shots, etc. Am I just asking a stupid question?
        • 29384
        • 6 Posts
        Quote from: mglerner at Aug 12, 2006, 04:41 PM

        Hi,

        I’m trying to set up a minimal blog with categories. So, I made a template variable like this:

        Variable Name: BlogCategory
        Caption: Zee Blog Category
        Description: Category of the blog post
        Input Type: Check Box
        Input Option Values: Baby||Garden||Website
        Default Value: Baby
        Widget: Delimited List
        Delimiter: ,
        Sort Order: 0

        All Templates and Document Groups are allowed to use this.

        So, when I make a new document, I see my TV, and all three choices for it (Baby, Garden, Website). However, if I unclick Baby and click Garden and then save it, it still ends up with Baby selected.

        What am I doing wrong?


        Might check if you have the document set a cached.
        Would load with your default, you would change....refresh and the cached version loads again with default.

        terry
          • 32963
          • 1,732 Posts
          I’m not sure what version of MODx you are using but have a look at the manager/processors/save_content.processor.php and look for the section labelled "// handles checkboxes & multiple selects elements", then make sure it’s looking some like this:

          // handles checkboxes & multiple selects elements
          $feature_insert = array();
          while (list($featureValue, $feature_item) = each ($_POST["tv".$row[’name’]])) {
          $feature_insert[count($feature_insert)] = $feature_item;
          }
          $tmplvar = implode("||",$feature_insert);
            xWisdom
            www.xwisdomhtml.com
            The fear of the Lord is the beginning of wisdom:
            MODx Co-Founder - Create and do more with less.
            • 19220
            • 26 Posts
            My computer died pretty hard and I just finished fixing it. I’ll try both of these things out. Thanks!
              • 19220
              • 26 Posts
              Hi,

              Niether of these seem to help:

              1) I set the document to uncacheable. When I’m editing it, I can set the TV to Garden under the General tab, and it sticks temporarily. That is, if I then click on the Page Settings tab, it’ll show up as garden. Ditto for any of the other tabs (that is, if I set it in any of them, I see it in the others). However, as soon as I click on the Save button, it reverts to the default option (Baby).

              2) I’m using MODx 0.9.2.1 (rev 1005). The PHP looks basically the same to me. The only difference I see is that there’s a space between "each" and the opening parenthesis on the third line of mine

              3) If I get rid of the default value, I can never set the TV to any value. If I change the default value to Garden, I get the expected behavior that all pages end up with the value Garden.

              Any more guesses?

              Thanks!
                • 19220
                • 26 Posts
                I’ve poked around some more, and still no luck. I’d like to just re-install everything, but we have quite a bit of content up, so that’s not going to work. Any more ideas, or is it time for me to figure out the PHP equivalent of "printf debugging"?
                  • 27226
                  • 186 Posts
                  I could reproduce your issue. So I think even re-installing would be of no help.
                  However, I found a setting which worked for me, i.e. stores individual TV-values:
                  As a widget I used "String formatter", not "Delimited List" (with "sentence case" as the sub-setting).
                  And left the rest as you have it.
                  The drawback is, that the default value does not work any more.
                  I was always a bit suspicious of those "widget" stuff and rarely used it. undecided
                  And the inheritance of TV-values also has some problems, and maybe this also affects this default-value stuff.

                  I hope that one from the dev-team drops in and gives you more competent help.
                  I just thought that storing the TV-values is the most important aspect, not the default value.
                  tongue
                    • 19220
                    • 26 Posts
                    silent-

                    Hopefully the fact that it’s reproducable will get a little attention from the dev-team. Thanks!

                    So, I changed the widget to "String formatter" and then selected "sentence case" .. but that didn’t help for me. I get the exact same behavior. I also tried creating new documents, in case it was just a problem with editing TVS for existing documents, but that didn’t work either. Are you sure you didn’t change anything else? FWIW, I tried leaving a default value of "Garden" and also deleting the default value. Neither worked.
                      • 27226
                      • 186 Posts
                      Screen-shot showing my TV-setup attached. One of the differences might be that I haven’t tried to edit the TV from the frontend, just from the manager-backend.