繁体   English   中英

为什么我不断收到此错误:错误:Email 格式错误?

[英]Why do I keep getting this error: Error: Email is badly formatted?

在我的网站上输入这个 email 地址 (danidust277@gmail.com) 时,我一直收到这个错误。 为什么?

HTML:

<div>
    <input type="text" id="update_profile_displayname" placeholder="Display Name"><br></br>
    <input type="email" id="update_profile_email" placeholder="Email Address"><br></br>
    <button type="button" type="submit" id="update_profile_submit">Save changes</button>
</div>

记者:

var update_email = document.getElementById("update_profile_email");    
var update_name = document.getElementById("update_profile_displayname");

user.updateEmail('update_email').then(function() {    
}).catch(function(error) {
    console.log(error)
    window.alert(`An error occured:${error}`);  
})

我猜user.updateEmail是一种接受有效 email 地址作为参数的方法。 在这种情况下,您不应传递字符串 'update_email',而应传递输入字段的值,这会导致user.updateEmail(update_email.value) 你已经尝试过了吗?

我认为您应该将update_email.value作为参数传递给user.updateEmail ,就像上面的 Davide Bulbarelli 所说的那样。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM