We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14883 ☆ A M B ☆
    • 450 Posts
    I’m trying to modify the Register snippet by adding a "Confirm Email" field. Trying to add a custom validator that returns an error if Confirm Email does not match Email field.
            <label for="email">[[%register.email? &namespace=`login` &topic=`register`]]
                <span class="error">[[+error.email]]</span>
            </label>
            <input type="text" name="email:required:email" id="email" value="[[+email]]" />
            
            <label for="email_confirm">[[%register.email_confirm]]
                <span class="error">[[+error.email_confirm]]</span>
            </label>
            <input type="text" name="email_confirm:email_confirm=`[[+email]]`" id="email_confirm" value="[[+email_confirm]]" />
            


    My ’email_confirm’ snippet looks like this:
    <?php
    if ($scriptProperties['value'] != $scriptProperties['param']) {  
        return 'Email addresses must match...' . $scriptProperties['value'] . ' does not match ' . $scriptProperties['param'];  
    }  
    return true;
    ?>


    Problem is, $scriptProperties[’param’] seems to be replacing ’.’ with ’_’ in the email address... so the validator always fails. "[email protected] does not match jrotering@gmail_com"...

    I thought about just doing a str_replace to set ’_’ back to ’.’, but that would mess up email addresses that have a legit underscore in them.

    What’s the dealio with this? Why the character substitution?
      • 28215
      • 4,149 Posts
      That’s definitely some sort of bug, and should not be happening. I’ll take a look at it next week at the latest. Can you file it here:

      http://github.com/splittingred/Login/issues

      Thanks James.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com