I have a signup form that requires an email. when a user uses an android device and enters their email, if they have used the device before android auto suggests their email. If the user selects the auto suggestion it ads a trailing blank space at the end. then when the user goes to signup the system says invalid email because of the blank space. users dont always see the blank space. How can I remove the trailing blank space automatically.

I already have a piece of js that uses the check this function to compare email address entered for repeat email.

```
<form name="account_reg_form" method="post" action="{$rlBase}{if $config.mod_rewrite}{$pageInfo.Path}.html{else}?page={$pageInfo.Path}{/if}" enctype="multipart/form-data">
    <div style="margin-top:10px;">
        <input style="text-transform:lowercase;" id="eMail" size="45" class="wauto" type="text" name="profile[mail]" {if $smarty.post.profile.mail}value="{$smarty.post.profile.mail}"{/if} required oninput="check(this)" />
    </div>
    <div style="margin-top:10px;">
        <input size="45" class="wauto" id="eMail_repeat" type="text" name="email_addr_repeat" title="Repeat your email address" placeholder="Repeat your email address" required oninput="check(this)" />
    </div>
    <input type="submit" value="{$lang.next_step}" />
</form>
<script>
    function check() {
        var email = document.getElementById('eMail');
        var emailRepeat = document.getElementById('eMail_repeat');

        if (email.value != emailRepeat.value) {
            emailRepeat.setCustomValidity('The two email addresses must match.');
        } else {
            // input is valid -- reset the error message 
            emailRepeat.setCustomValidity('');
        }
    }
</script>
<input style="text-transform:lowercase;" id="eMail" size="45" class="wauto" type="text" name="profile[mail]" {if $smarty.post.profile.mail}value="{$smarty.post.profile.mail}"{/if} required oninput="check(this)" />

```