On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi chaps, I am trying to use some custom validation to make sure the 'email' and 'confirm_email' fields on my Login Register forms are the same.. seems simple enough... and have followed the example here > https://rtfm.modx.com/extras/revo/login/login.register#Login.Register-CustomValidators but it does not work... Is the example code wrong?

    Using the example code, the only way to pass the custom validation is if your matched field includes the exact characters within the ^^ text in the Register code call - I had thought it would be OK to place a field name in their to compare... e.g. equalTo=^email^ - but instead of comparing and checking to make sure the confirm_email field contains the same text as the email field, it wants the confirm_email field to actually contain the characters 'email'!!!??? How can I get it to compare the contents of a field rather than a string?

    This question has been answered by BobRay. See the first response.

    [ed. note: dubbs last edited this post 4 years ago.]
    • discuss.answer
      Register claims to have the same built-in validators as FormIt. Have you tried this?

      &validate=`confirm_email:password_confirm=^email^`
        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
      • Quote from: BobRay at Sep 22, 2015, 07:27 AM
        Register claims to have the same built-in validators as FormIt. Have you tried this?

        &validate=`confirm_email:password_confirm=^email^`

        I have... but not as you have written it... e.g. I have tried:

        &validate=`confirm_email:confirm_email=^email^`


        Maybe that's why it didnt work... will try your code snippet...
        • This works.... wink

          email_confirm:password_confirm=^email^


          But the error when they don't match mentions the work password... any idea where the PHP tpl is so I can update the text?
          • My guess is that it's a lexicon string. Check in Lexicon Management in the login (or register) namespace.
              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