We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26503
    • 620 Posts
    I'm trying to validate a group of checkboxes on a register form, they all have different names, so I need to write a custom validator that will do this. Problem is that the custom validator does not seem to work at all, this is what I have right now [for testing];


    [[!Register? 
    	<!-- simplified for clarity -->
    	&customValidators=`aiRequired` 
    	&validate=`
    		box-a:aiRequired,
    		username:required,
    		password:required,
    
    ]]


    The test validator looks like:

    <?php
    //
    $modx->log(modX::LOG_LEVEL_ERROR,'starting snippet');
    $modx->log(modX::LOG_LEVEL_ERROR,$param);
    
    return false;


    It does dump a couple log entries, but the form still validates! arg!

    1. isn't register supposed to validate the form if I return true & fail validation if I return false?
    2. are all the form fields available in the validator? I have several to pass in to make sure at least one was checked, i.e.
    &validate=`extension:aiRequired=^box-a, box-b box-c, etc^,


      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

      Sean Kimball CLP, CLS.
      Technical Director / Sr. Developer | BigBlock Studios
      ._______________________________________________.
      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
      phone/fax: 905-426-5525
      • 3749
      • 24,544 Posts
      Maybe it's just a transcription error, but the final comma in your Register tag should be a back-tick. I'd also put the validate property all on one line.
        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