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?