We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21496
    • 225 Posts
    I was creating a TV with input type "Check Box", for "Input Option Values" I insert ’yes’, and for the "Default Value" also ’yes’. When editing a document with that TV, the check box appears as checked, but when I uncheck it, it’s not stored.

    Am I doing something wrong here?

    I tested with input type "Radio Options" and ’yes||no’ as input option values, which works fine.
      René
      • 33372
      • 1,611 Posts
      Quote from: nightsignals at Oct 01, 2007, 03:29 PM

      ...but when I uncheck it, it’s not stored.
      Not sure what you mean here. You uncheck the checkbox and no value is stored for the TV? If so, that’s how it’s supposed to work...

      Or do you mean that you uncheck it but when you edit the document after saving it’s checked again?
        "Things are not what they appear to be; nor are they otherwise." - Buddha

        "Well, gee, Buddha - that wasn't very helpful..." - ZAP

        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
        • 21496
        • 225 Posts
        Quote from: ZAP at Oct 01, 2007, 04:36 PM

        Or do you mean that you uncheck it but when you edit the document after saving it’s checked again?

        Exactly - I uncheck it, and it’s ignored.
          René
          • 21496
          • 225 Posts
          nightsignals Reply #4, 19 years ago
          Okay - I did some more testing. When not assigning a default value, it works. So I can rephrase my question: how can I use a TV with checkbox in a way it’s checked on default?
            René
            • 33372
            • 1,611 Posts
            You’re right. I usually use radio buttons for Yes/No choices, so I hadn’t noticed this before. But I just created a checkbox like the one you describe and it does indeed ignore me when I uncheck it.

            I’ve opened a bug report for this on FlySpray: http://modxcms.com/bugs/task/957

            I imagine that this is just the default value logic behaving in a counterintuitive way (the default value is entered automatically when the value is set to blank, so the checkbox reverts to "yes" after you uncheck it). Definitely something to take into account for the new core, but I’m not sure it will get fixed in 0.9.6 since I expect it would require a fairly comprehensive rewrite of that logic. For now, I recommend that you use Yes/No radio buttons instead (or I suppose that you could reverse your choices, i.e. unchecked is default and checked is to not do whatever it is you’re doing).

              "Things are not what they appear to be; nor are they otherwise." - Buddha

              "Well, gee, Buddha - that wasn't very helpful..." - ZAP

              Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
              • 21496
              • 225 Posts
              nightsignals Reply #6, 19 years ago
              okay - thanks zap for confirming it as a bug. I go back to use the radio buttons then.
                René
                • 21496
                • 225 Posts
                nightsignals Reply #7, 19 years ago
                It seems there was a similar issue in earlier versions, though only for multiple checkboxes:

                http://modxcms.com/forums/index.php/topic,4697.0.html

                ... though in the bug report it says it was fixed:

                http://modxcms.com/bugs/task/414
                  René
                  • 33372
                  • 1,611 Posts
                  Looks like a different issue to me, since multi-selects and multiple checkboxes have worked properly since 0.9.5 I think.
                    "Things are not what they appear to be; nor are they otherwise." - Buddha

                    "Well, gee, Buddha - that wasn't very helpful..." - ZAP

                    Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                    • 7231
                    • 4,205 Posts
                    I confirm I have the same issue. It drove me crazy for a while and I just worked around it by changing my method and used something else. I thought I was doing something wrong.
                      [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]
                      • 25969
                      • 118 Posts
                      Just bumping this "bug report" to say you need to set an input option value otherwise it won’t work as noted above. Setting an input option value such as "Yes==1", as noted in the documentation, solves this.