form submission judgment, data can only be submitted once judgement

Source: Internet
Author: User

<!DOCTYPE HTML>
<HTMLLang= "en">

<Head>
<MetaCharSet= "UTF-8">
<title>Property Repair-Fill in the information</title>
<Metacontent= "Yes"name= "Apple-mobile-web-app-capable">
<Metacontent= "Yes"name= "Apple-touch-fullscreen">
<Metacontent= "Telephone=no"name= "Format-detection">
<Metacontent= "BLACK"name= "Apple-mobile-web-app-status-bar-style">
<Metaname= "Viewport"content= "width=device-width,minimum-scale=1.0,maximum-scale=1.0" />
<Linkrel= "stylesheet"type= "Text/css"href= "http://static.17shihui.com/pageapp/css/comact/mobile.common.css?static_version=1438944758593">
<Linkrel= "stylesheet"type= "Text/css"href= "Http://static.17shihui.com/communitym/cm1.10/css/mobile.alert.css">
<Linkrel= "stylesheet"type= "Text/css"href=".. /css/style.css ">
</Head>

<Body>
<Divclass= "Fill_wrap">
<labelclass= "Name IPT">
<inputtype= "text"placeholder= "Please enter your name"ID= "Name">
</label>
<labelclass= "Tel IPT">
<inputtype= "Tel"placeholder= "Please enter your phone"ID= "Tel">
</label>
<textareaclass= "Int_des"ID= "description"placeholder= "Please describe the situation as clearly as possible, including the specific location, damaged items, etc." "></textarea>
<ahref= "javascript:void (0)"class= "Btns"ID= "Btns">Feedback</a>
</Div>
<Scriptsrc= "Http://static.17shihui.cn/libs/zepto/zepto.min.js"></Script>
<Scriptsrc= "Http://static.17shihui.com/communitym/cm1.10/js/mobile.alert.js"></Script>
<Scripttype= "Text/javascript"src=".. /js/fill.js ">
functionGetQueryString (name) {
varReg =NewRegExp ("(^|&)" + name + "= ([^&]*) (&|$)", "I");
varr = Window.location.search.substr (1). Match (REG);
if(r! =NULL)returnR[2];
returnNULL;
};

functionFillcome (ele) {

varName = $ ("#name"). Val ();
varTel = $ ("#tel"). Val ();
varDescription = $ ("#description"). Val ();
if(!filltab ()) {
return;
}
Ele.addclass ("box");

$.post ("/main/saas/repair/add", {
Name:name,
Tel:tel,
Description:description,
},function(data) {
if(Data.apistatus = = 1) {
Alert ("Thank you for your help and feedback, the property will be processed as soon as possible");
}

Ele.removeclass ("box");
});
}

functionFillshow () {
$.get ("/main/saas/repair/get_by_id", {id:getquerystring ("id")},function(data) {
varrel = Data.result;
if(Data.apistatus = = 1) {
$ ("#name"). Val (Rel.name);
$ ("#tel"). Val (Rel.tel);
$ ("#description"). HTML (rel.description);
$ ("#btns"). Hide ();
}
})
}

if(GetQueryString ("id")) {
Fillshow ();
}Else{
$ ("#btns"). Click (function() {
var_this = $ ( This);
if(!_this.hasclass ("box")) {
Fillcome (_this);
}
})
}

functionFilltab () {

varFlag =false;
varName = $ ("#name"). Val ();
varTel = $ ("#tel"). Val ();
varDescription = $ ("#description"). Val ();

varSTR2 =/^[\u4e00-\u9fa5a-za-z]{2,8}$/;
varSTR3 =/^1[0-9]{10}$/;

if(Name = = "") {
Alert ("Please enter your name");
returnfalse;
}
if(!str2.test (name)) {
Alert ("The name is not in the correct format");
returnfalse;
}
if(tel = = "") {
Alert ("Please enter your phone");
returnfalse;
}
if(!str3.test (tel)) {
Alert ("Phone format is incorrect");
return false;
}
if(Description = = "") {
Alert ("The problem description cannot be empty");
returnfalse;
}
returntrue;
}

</Script>
</Body>

</HTML>

form submission judgment, data can only be submitted once judgement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.