项目邀请--姓名、长度JS验证

tmp
huang 10 years ago
parent 2768317d08
commit 530d101024

@ -44,11 +44,11 @@
} }
function verifyFirstName() { function verifyLastName() {
var first_name = $.trim($('#first_name').val()); var last_name = $.trim($('#last_name').val());
if(first_name.length > 30) if(last_name.length > 30)
{ {
$("#valid_email").text("用户名字过长,最长为30个字符"); $("#valid_email").text("用户姓氏过长,最长为30个字符");
return false; return false;
} }
else else
@ -59,11 +59,11 @@
} }
function verifyLastName() { function verifyFirstName() {
var last_name = $.trim($('#last_name').val()); var first_name = $.trim($('#first_name').val());
if(last_name.length > 30) if(first_name.length > 30)
{ {
$("#valid_email").text("用户姓氏过长,最长为30个字符"); $("#valid_email").text("用户名字过长,最长为30个字符");
return false; return false;
} }
else else
@ -76,7 +76,7 @@
function senderEmail(obj) function senderEmail(obj)
{ {
if(verifyAddress()) if(verifyAddress() && verifyFirstName() && verifyLastName() )
{ {
obj.parent().submit(); obj.parent().submit();
} }
@ -110,13 +110,13 @@
<%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyAddress(this);" %> <%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyAddress(this);" %>
</li> </li>
<li> <li>
<%= text_field_tag 'first_name', '', :class => "fb_item_first_name fl", :placeholder => l(:label_input_email_lastname), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyLastName(this);" %> <%= text_field_tag 'last_name', '', :class => "fb_item_first_name fl", :placeholder => l(:label_input_email_lastname), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyLastName(this);" %>
</li> </li>
<li> <li>
<%= text_field_tag 'last_name', '', :class => "fb_item_last_name fl", :placeholder => l(:label_input_email_firstname), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyFirstName(this);" %> <%= text_field_tag 'first_name', '', :class => "fb_item_last_name fl", :placeholder => l(:label_input_email_firstname), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyFirstName(this);" %>
</li> </li>
<li> <li>
<select class="fb_item_gender fl" id="gender" name="gender"><option value="0">男</option><option value="1">女</option></select> <select class="fb_item_gender fl" id="gender" name="gender"><option value="">性别</option><option value="0">男</option><option value="1">女</option></select>
</li> </li>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>

@ -2025,8 +2025,8 @@ zh:
label_end_time: 截止时间 label_end_time: 截止时间
label_send_email: 确定发送 label_send_email: 确定发送
label_input_email: 请输入邮箱地址(必填) label_input_email: 请输入邮箱地址(必填)
label_input_email_firstname: 请输入用户名字(非必填) label_input_email_firstname: 请输入用户名字(可选)
label_input_email_lastname: 请输入用户姓氏(非必填) label_input_email_lastname: 请输入用户姓氏(可选)
label_input_email_gender: 请输入用户性别 label_input_email_gender: 请输入用户性别
#api end #api end

@ -47,7 +47,7 @@ a:hover.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;}
.fb_item{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:200px;} .fb_item{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:200px;}
.fb_item_first_name{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:150px;margin-left: 10px;} .fb_item_first_name{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:150px;margin-left: 10px;}
.fb_item_last_name{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:150px;margin-left: 10px;} .fb_item_last_name{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:5px; padding-left:5px; width:150px;margin-left: 10px;}
.fb_item_gender{ color:#919191; border:1px solid #919191; height:29px; margin-bottom:5px; padding-left:5px; width:48px;margin-left: 10px;} .fb_item_gender{ color:#919191; border:1px solid #919191; height:29px; margin-bottom:5px; padding-left:5px; width:58px;margin-left: 10px;}
a.icon_addm{ background:url(../images/img_floatbox.png) 0 -33px no-repeat; width:16px; height:16px; display:block; margin:5px 0 0 5px;} a.icon_addm{ background:url(../images/img_floatbox.png) 0 -33px no-repeat; width:16px; height:16px; display:block; margin:5px 0 0 5px;}
a:hover.icon_addm{background:url(../images/img_floatbox.png) 0 -61px no-repeat; } a:hover.icon_addm{background:url(../images/img_floatbox.png) 0 -61px no-repeat; }
a.icon_removem{ background:url(../images/img_floatbox.png) -22px -33px no-repeat;width:16px; height:16px; display:block; margin:5px 0 0 5px} a.icon_removem{ background:url(../images/img_floatbox.png) -22px -33px no-repeat;width:16px; height:16px; display:block; margin:5px 0 0 5px}

Loading…
Cancel
Save