33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
function submitForm() {
|
|
let isValid = true;
|
|
clearErrors();
|
|
|
|
if (!checkInfo.checkMobileNo()) {
|
|
document.getElementById('mobileNoError').innerText = '手机号格式有误';
|
|
isValid = false;
|
|
}
|
|
|
|
if (!checkInfo.checkPassword()) {
|
|
document.getElementById('passwordError').innerText = '密码须为长度为6-20位字母、数字或符号';
|
|
document.getElementById('confirmPasswordError').innerText = '两次输入的密码不一致';
|
|
isValid = false;
|
|
}
|
|
|
|
if (isValid) {
|
|
document.getElementById('encryptedPassword').value = md5(
|
|
document.getElementById('password').value
|
|
);
|
|
document.getElementById('encryptedConfirmPassword').value = md5(
|
|
document.getElementById('confirmPassword').value
|
|
);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function clearErrors() {
|
|
document.getElementById('mobileNoError').innerText = '';
|
|
document.getElementById('passwordError').innerText = '';
|
|
document.getElementById('confirmPasswordError').innerText = '';
|
|
}
|