注册时的标点符号处理

This commit is contained in:
cxt 2018-06-12 09:32:10 +08:00
parent 614513de0e
commit 83ecb9c196
2 changed files with 10 additions and 9 deletions

View File

@ -21,7 +21,7 @@
$(".navHomepageSearchBoxcontainer").mouseout(function(){ $(".navHomepageSearchBoxcontainer").mouseout(function(){
$(".navSearchTypeBox").css({display:"none"}); $(".navSearchTypeBox").css({display:"none"});
}); });
}) });
$(document).ready(function(){ $(document).ready(function(){
if(<%= @login%>){ if(<%= @login%>){
$("#signUpBox").css({display:"none"}); $("#signUpBox").css({display:"none"});
@ -37,15 +37,16 @@
var $passwd_correct = false; var $passwd_correct = false;
var $passwd_comfirm_correct = false; var $passwd_comfirm_correct = false;
jQuery(document).ready(function () { jQuery(document).ready(function () {
var $login = $('#user_login') var $login = $('#user_login');
var $mail = $('#user_mail') var $mail = $('#user_mail');
var $password = $('#user_password') var $password = $('#user_password');
var $password_confirmation = $('#user_password_confirmation') var $password_confirmation = $('#user_password_confirmation');
$login.blur(function (event) { $login.blur(function (event) {
if ($(this).is('#user_login')) { if ($(this).is('#user_login')) {
if (/^[a-zA-Z][a-zA-Z\d]{3,14}$/.test(this.value) == false){ if (/^[a-zA-Z][a-zA-Z\d]{3,14}$/.test(this.value) == false){
$('#login_req').html('<span style="color: #c00202">只能使用英文字母和数字必须以字母开头长度不少于4个字符、不超过15个字符</span>'); $('#login_req').html('<span style="color: #c00202">只能使用英文字母和数字必须以字母开头长度不少于4个字符、不超过15个字符</span>');
$('#login_req').show(); $('#login_req').show();
$login_correct = false;
return ; return ;
} }
else{ else{
@ -91,7 +92,6 @@
$('#mail_req').css('display','block'); $('#mail_req').css('display','block');
}); });
} }
;
}); });
$password.blur(function () { $password.blur(function () {
var pas1 = document.getElementById("user_password").value; var pas1 = document.getElementById("user_password").value;
@ -186,8 +186,8 @@
<%= error_messages_for 'user' %> <%= error_messages_for 'user' %>
<ul> <ul>
<li class="new_register_li"> <li class="new_register_li">
<%= f.text_field :mail, :size => 25, :class => 'new_register_input' , :placeholder => "请输入邮箱地址"%> <%= f.text_field :mail, :size => 25, :class => 'new_register_input', :placeholder => "请输入邮箱地址"%>
<p class="new_login_error" id="mail_req" style="display: none" >请输入正确的邮箱</p> <p class="new_login_error" id="mail_req" style="display: none">请输入正确的邮箱</p>
</li> </li>
<li class="new_register_li"> <li class="new_register_li">
<%= f.password_field :password, :size => 25, :placeholder => "请输入密码", :class => 'new_register_input' %> <%= f.password_field :password, :size => 25, :placeholder => "请输入密码", :class => 'new_register_input' %>

View File

@ -607,6 +607,7 @@ function register(){
return; return;
} }
if($login_correct && $mail_correct && $passwd_correct && $passwd_comfirm_correct && $("#read_and_confirm").attr("checked") == 'checked'){ if($login_correct && $mail_correct && $passwd_correct && $passwd_comfirm_correct && $("#read_and_confirm").attr("checked") == 'checked'){
$("#loginUpButton").addClass('new_login_submit_disable');
$("#main_reg_form").submit(); $("#main_reg_form").submit();
}else{ }else{
$('#user_login').blur(); $('#user_login').blur();