We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46039
    • 76 Posts
    Hey bob, the first issue was solved by renaming the submit button.

    The checkboxes are not in the POST array at all. Anything with type checkbox seems to have been ignored. Any ideas?
      • 3749
      • 24,544 Posts
      Checkboxes are funky, if they're separate checkboxes and not checked, they don't go in the $_POST. You'll probably have to rewrite the snippet code to handle them. This might help: http://stackoverflow.com/questions/4997252/get-post-from-multiple-checkboxes.


      [ed. note: BobRay last edited this post 8 years, 8 months ago.]
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 46039
        • 76 Posts
        I think I may have solved this, but had to write a quick filter snippet because the built in filters didn't work on the user page:

        (Using ClassExtender)

        In register page:
        <label for="bool">BOOL CHECKBOX</label>
                <input type="hidden" name="bool" value="0"  [[!+reg.bool:checkfor=`0`]] />
                <input type="checkbox" name="bool" id="bool" value="1" [[!+reg.bool:checkfor=`1`]] /><br/>


        In user fields:
        <div class="x-form-item x-tab-item">
                <input type="hidden" name="bool" value="0" [[+bool:checkfor=`0`]] />
                <input type="checkbox" name="bool" id="bool" value="1" [[+bool:checkfor=`1`]]  class="x-form-text x-form-field"
                        onClick="Ext.getCmp('modx-panel-user').markDirty();" /><br/>
            </div>


        snippet (checkfor):
        <?php
        if ( $options === '0' && $input === '0' ){
            return 'checked';
        }
        
        if ( $options === '1' && $input === '1' ){
            return 'checked';
        }


        Does this look sound? It certainly seems to work fine.

        The POST issue seemed to be related to passing null values, as soon as you force a value it seems to work as with text fields.
          • 3749
          • 24,544 Posts
          It looks good to me, though I don't know why the regular code wouldn't catch those.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting