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

This commit is contained in:
huang 2015-10-09 11:25:21 +08:00
parent 2768317d08
commit 530d101024
3 changed files with 22 additions and 22 deletions

View File

@ -44,21 +44,6 @@
}
function verifyFirstName() {
var first_name = $.trim($('#first_name').val());
if(first_name.length > 30)
{
$("#valid_email").text("用户名字过长,最长为30个字符");
return false;
}
else
{
$("#valid_email").text("");
return true;
}
}
function verifyLastName() {
var last_name = $.trim($('#last_name').val());
if(last_name.length > 30)
@ -74,9 +59,24 @@
}
function verifyFirstName() {
var first_name = $.trim($('#first_name').val());
if(first_name.length > 30)
{
$("#valid_email").text("用户名字过长,最长为30个字符");
return false;
}
else
{
$("#valid_email").text("");
return true;
}
}
function senderEmail(obj)
{
if(verifyAddress())
if(verifyAddress() && verifyFirstName() && verifyLastName() )
{
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);" %>
</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>
<%= 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>
<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>
</ul>
<div class="cl"></div>

View File

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

View File

@ -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_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_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: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}